Skip to main content
← Tech Stackups News
On Hacker News

Looking Forward to Postgres 19: Query Hints

184
points
32
comments
2
notable voices

The 5-second version

  • Postgres 19 introduces query hints through two contrib modules: pg_plan_advice and pg_stash_advice, branded as "plan advice" rather than traditional hints.
  • Plan advice is kept entirely outside SQL queries via GUCs or a query-ID-based stash, addressing maintenance concerns about embedding hints in query text.
  • The advice constrains rather than replaces the planner's search space, only nudging toward plans the core planner already considers viable.
  • When advice becomes outdated or wrong, the planner marks affected nodes as Disabled and falls back to the best remaining plan instead of failing silently.
  • The feature represents a 15-year evolution in community thinking, led by Robert Haas, who designed it to address every major historical objection to query hints in Postgres.

Top voices

Verbatim comments from the thread's most notable / highest-karma participants.

Someonenotable32.9k karma
> where you want to guarantee no table scan ever. If hints are what they say they are, they cannot guarantee anything. And they indeed are hints. FTA: “The documentation is explicit: advice "can only produce plans the core planner considers viable." Advice only nudges the planner toward one it already considered.”
Read on HN ↗
bob1029notable22k karma2 comments
Give the customer what they want, even if it sucks to do so. The alternative it be cast into irrelevance over time. You can run an OSS project however you want, but you can't avoid the consequences of doing so. Principles driven development (we will never or always do X regardless of context) typically comes off as a petty ego trip. The point of the technology is to serve some kind of downstream business. Most people who download Postgres are seeking to solve a real world problem, not to demons…
Read on HN ↗
skywhopper11.5k karma4 comments
What are you talking about? This has nothing to do with the article, which describes a query plan advice provider that solves lots of problems with typical hint systems, and does so in a manner good enough to be worthy of including in core, rather than throwing in a half-baked broken clone of Oracle because people are scared to install an extension.
Read on HN ↗
mpyne8k karma
This issue was one of AWS's listed reasons for tending to prefer NoSQL style databases over "more performant" RDBMS, because of the more consistent worst-case performance, even if the result is worse average-case performance, which was important in their assumptions for scalability planning.
Read on HN ↗