For decades, the PostgreSQL community maintained a firm ideological stance against query planner hints. The philosophy was simple: planner failures are bugs that should be fixed in the optimizer, not worked around with manual directives in production SQL.
Postgres 19 fundamentally changes this operational model with two new contrib modules: pg_plan_advice and pg_stash_advice. Instead of altering SQL syntax or forcing fragile comment hacks like older third-party tools did, these extensions operate at the session and query identifier levels. Engineers can now deterministically pin scan methods, enforce join orders, dictate join algorithms, and control partitionwise joins.
The real architectural breakthrough for production stability is pg_stash_advice. By binding plan hints directly to a query identifier, database administrators can remediate pathological query plan regressions in production without requiring an application release or modifying application code. When an unexpected stats drift turns an efficient index scan into an expensive sequential scan, you can immediately stabilize execution.
Manual hints do carry hazards, especially as dataset sizes scale past the assumptions of your fixed join order. However, having a deterministic, out-of-band operational lever transforms emergency database triage when you cannot wait for an optimizer patch.










