3 comments

  • lfittl20 minutes ago
    Its also worth reading the original post by Robert Haas (the author of pg_plan_advice) on motivation&#x2F;design: <a href="https:&#x2F;&#x2F;rhaas.blogspot.com&#x2F;2026&#x2F;03&#x2F;pgplanadvice-plan-stability-and-user.html" rel="nofollow">https:&#x2F;&#x2F;rhaas.blogspot.com&#x2F;2026&#x2F;03&#x2F;pgplanadvice-plan-stabili...</a><p>Also, I&#x27;ll add my perspective: I think &quot;EXPLAIN (PLAN_ADVICE)&quot; is a key piece to making this a plan stability feature, not (just) a hinting feature. The extensibility&#x2F;framework pg_plan_advice adds is a foundation, that over time will over time address the age-old &quot;Postgres doesn&#x27;t have hints&quot; problem, even if the initial release doesn&#x27;t check all the boxes yet, e.g. no way to use advice for adjusting row&#x2F;join estimates.<p>To give an example on extensibility: Some people that I&#x27;ve spoken to are asking &quot;but why is it not a comment-style hint&quot;. There are reasons why Postgres didn&#x27;t go that way for this release (comment parsing in core is non-existent today, and comments don&#x27;t work correctly e.g. for functions), but its easy to write an extension that sets up an advisor hook to parse comments: <a href="https:&#x2F;&#x2F;github.com&#x2F;pganalyze&#x2F;pg_advice_comment" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pganalyze&#x2F;pg_advice_comment</a>
  • crimsonnoodle581 hour ago
    &gt; How many of us have toggled enable_seqscan to off to force an index scan? Or thrown an OFFSET 0 into a subquery to prevent the planner from flattening it?<p>enable_nestloop = off here.<p>For us, joining many complex views quickly trips the planner up, so I&#x27;m really glad to see this.<p>&gt; They break on upgrades.<p>The irony is so does the planner. I&#x27;ve seen queries working perfectly fine in older PG&#x27;s suddenly run away in newer versions. So hints will actually bring stability.
  • robertlagrant1 hour ago
    I&#x27;m not an expert in database hints, but the syntax looks very readable and composable. That&#x27;s great thing to have got right.