BotBeat
...
← Back

> ▌

PostgreSQL (Open Source Project)PostgreSQL (Open Source Project)
PRODUCT LAUNCHPostgreSQL (Open Source Project)2026-04-21

PostgreSQL 19 Introduces pg_plan_advice Module for Query Plan Control

Key Takeaways

  • ▸PostgreSQL 19 adds pg_plan_advice contrib module enabling users to stabilize or override query planner decisions through textual plan advice
  • ▸Plan advice can be generated from finished plans, manually edited by users, or written from scratch to control specific planner outcomes like scan type selection
  • ▸The feature addresses a decades-long community request for query hints while maintaining limitations to prevent abuse, though users must exercise caution to avoid suboptimal query performance
Source:
Hacker Newshttps://www.depesz.com/2026/03/22/waiting-for-postgresql-19-add-pg_plan_advice-contrib-module/↗

Summary

PostgreSQL 19 introduces the pg_plan_advice contrib module, a new facility that allows database administrators and knowledgeable users to stabilize or override query planner decisions. Committed by Robert Haas on March 12, 2026, this module addresses a long-standing request from the PostgreSQL community for "hints" — a mechanism to influence how the query planner selects execution strategies.

The pg_plan_advice module works by analyzing completed query plans and generating textual advice that describes key planner decisions. When this advice is provided during future planning cycles, it forces the planner to make identical decisions. Users can also manually edit or create plan advice from scratch, enabling query optimization strategies that the planner would not naturally produce. The module currently focuses on specific outcomes like choice of sequential vs. index scans for particular relations, though it does not yet cover broader cost estimation or aggregation decisions.

The feature represents a significant shift in PostgreSQL's philosophy, as the development community historically resisted implementing hint systems. However, reviewers acknowledge that while the new capability could be misused to create suboptimal query plans, it provides valuable tools for solving complex performance problems that are otherwise difficult to address. The module has been extensively reviewed by experienced PostgreSQL contributors including Lukas Fittl, Jakub Wartak, and others.

  • Currently scoped to specific planner outcomes with selectivity estimates and costing decisions deliberately excluded from this initial implementation

Editorial Opinion

The pg_plan_advice module represents a pragmatic evolution in PostgreSQL's approach to query optimization, balancing the community's historical skepticism about hints with the practical reality that real-world databases often require manual intervention due to imperfect statistics and edge cases. While the feature undoubtedly carries risks—as powerful tools often do—its careful design with explicit scope limitations and the requirement for deliberate user action suggests the PostgreSQL team has learned from decades of hint-system debates. This addition will likely prove invaluable for experienced database professionals managing complex workloads, though novice users should indeed heed the warnings about thinking "twice and perhaps three times" before constraining the planner.

Machine LearningOpen Source

Comments

Suggested

Independent ResearchIndependent Research
RESEARCH

Research Study Reveals Significant Performance Gaps for LLMs Across Non-English Languages

2026-04-21
Ruby on RailsRuby on Rails
UPDATE

Rails 8's Solid Queue Gets Fiber-Based Worker Execution for High-Concurrency LLM Streaming

2026-04-21
OpenAIOpenAI
RESEARCH

Research Shows LLMs Struggle with Probabilistic Reasoning in Strategic Games Like Poker

2026-04-21
← Back to news
© 2026 BotBeat
AboutPrivacy PolicyTerms of ServiceContact Us