The PostgreSQL development community is preparing to add query hints in the upcoming version 19, a feature that database administrators and developers have requested for years. The change represents a notable departure from the project's longstanding philosophy of avoiding explicit hints in favor of automatic query optimization.
What Query Hints Do
Query hints allow developers to override the database's query planner, the component that decides how to execute a SQL statement. In complex databases, the planner sometimes chooses inefficient paths, causing slow performance. Hints let a developer manually direct the planner to use a specific index, join method or execution order.
PostgreSQL's planner is widely respected for its effectiveness. But real-world workloads often involve edge cases the planner cannot handle well. Large joins, uneven data distributions or outdated statistics can lead to poor execution plans. Hints give experienced users a way to fix these issues without restructuring queries or rewriting application code.
Other major database systems including Oracle, MySQL and SQL Server have long supported query hints. PostgreSQL held out due to concerns that hints encourage short-term fixes over proper database tuning.
A Long Debate Inside the Community
The PostgreSQL community debated query hints for over a decade. Proponents argued that enterprise users needed the feature to migrate from commercial databases. Opponents warned that hints create brittle applications that break when data changes.
Supporters pointed to the pg_hint_plan extension, a third-party tool that added hints to PostgreSQL. Thousands of production systems used it, proving demand was real. But extensions lack official support and can break with new releases.
The decision to include hints natively came after years of compromise. The implementation will include safeguards to prevent misuse. Hints will not bypass security checks or allow unsafe operations.
Why This Matters
This feature directly affects database administrators, backend developers and companies running PostgreSQL at scale. Slow queries cost time and money. Inefficient database performance can slow web applications, increase cloud computing costs and cause customer dissatisfaction.
For organizations migrating from Oracle or SQL Server, query hints remove a major compatibility barrier. Many existing SQL workloads rely on hints. Without native support, PostgreSQL was a harder sell for large enterprises with complex legacy systems.
The change also affects the PostgreSQL ecosystem. Developers of performance monitoring tools and query tuning software will need to update their products to recognize and manage the new hint syntax. Training materials and best practice guides will need revision.
Implementation Details
The hint system uses comment-style syntax embedded in SQL statements. Hints appear as specially formatted comments that the planner parses during query execution. This approach keeps the SQL standard compliant while giving the planner extra guidance.
PostgreSQL 19 remains in active development. The feature may change before the final release. Beta versions will likely appear in mid-2025 with a stable release expected by late 2025.
Database administrators should test hints carefully in staging environments before deploying them to production. Misapplied hints can make performance worse. The community recommends exhausting other optimization methods like indexing, vacuuming and statistics tuning before resorting to hints.



