← Retour au blog
tech 9 June 2026

Looking Forward to Postgres 19: The New Horizons of Query Hints

Postgres 19 is set to introduce 'plan advice' to optimize your queries. Discover what this means for developers and DBAs.

Article inspired by the original source
Looking Forward to Postgres 19: Query Hints ↗ www.pgedge.com

Introduction

In the realm of databases, Postgres is often celebrated for its robustness and flexibility. However, the absence of 'query hints' has long been a topic of debate. With the upcoming release of Postgres 19, this gap might finally be bridged with the introduction of two new modules: pg_plan_advice and pg_stash_advice. This development marks a significant shift in the use of Postgres for query tuning.

Why Query Hints?

Historically, the Postgres community has opposed 'query hints'. The reasons were manifold: maintenance complexity, risks of obsolescence during upgrades, and the tendency to avoid root cause analysis of performance issues. Yet, in critical situations, like queries that defy optimization, having a workaround mechanism is crucial.

For instance, in a recent survey conducted by Stack Overflow, 35% of developers stated that database optimization was a major challenge in their projects. 'Query hints' could offer a temporary but valuable solution in extreme performance contexts.

The pg_plan_advice and pg_stash_advice Modules

The pg_plan_advice module allows DBAs to provide execution recommendations for queries. Rather than forcing the engine to follow a specific plan, it suggests possible optimizations. This gentler approach preserves the integrity of the optimizer while granting some control.

pg_stash_advice, on the other hand, stores these recommendations for future use, making it easier to track and manage proposed optimizations. These modules do not replace the need for good statistics management but offer an additional tool in the DBA's arsenal.

Use Cases and Benefits

Consider an e-commerce company managing a massive database with seasonal traffic spikes. During sales periods, query response time can determine the success or failure of marketing campaigns. 'Plan advice' will allow DBAs to react swiftly and adjust execution strategies without waiting for a full statistical analysis.

In another scenario, a tech startup using real-time data for predictive analytics could benefit from these modules to adjust critical queries on the fly, ensuring smooth operations.

Conclusion

The introduction of 'plan advice' in Postgres 19 is a landmark advancement for the open-source database world. It offers a balance between the need for flexibility and system integrity. For businesses, this means less time lost on manual adjustments and more time dedicated to innovation.

Let's discuss your project in 15 minutes.

Postgres 19 query hints pg_plan_advice database optimization DBA tools
Deepthix newsletter · 100% AI · every Monday 8am

An AI agent reads tech for you.

Our AI agent scans ~200 sources per week and ships the best articles to your inbox Monday 8am. Free. One click to unsubscribe.

Visit the newsletter page →

Want to automate your operations?

Let's talk about your project in 15 minutes.

Book a call