Hints and hazards: pg_plan_advice in PG19
Web page · https://clickhouse.com/blog/pg-plan-advice-postgresql-19
First seen by Oriel on .
AI summary
This ClickHouse article evaluates PostgreSQL 19’s pg_plan_advice and pg_stash_advice, showing how hints can correct bad plans while warning they may be ignored or reduce performance.
- pg_plan_advice provides session-level advice for scan methods, join order, join methods, parallelism, partitionwise joins, and semijoin uniqueness.
- pg_stash_advice applies equivalent advice persistently to query identifiers rather than individual query text.
- Advice constrains the planner instead of forcing a plan, so it can be partially ignored and has no validation against performance degradation.
- For clustered data, BITMAP_HEAP_SCAN reduced execution time from about 1,462 milliseconds to 9.7 milliseconds.
- Changing join order for correlated filters reduced a test query from 3,837 milliseconds to 20.3 milliseconds, nearly a 200-fold improvement.
#postgresql #query planning #database performance #query hints
Generated by gpt-5.6-sol. Check the original for details.
Metric trends
Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained
Points
Score reported by the source.
- Lobsters: 4, latest observation ; +3 over observed period since
Comments
Comment count reported by the source.
- Lobsters: 1, latest observation ; +1 over observed period since
Aliases
| Source | External ID | URL |
|---|---|---|
| Lobsters | nfce9x | https://clickhouse.com/blog/pg-plan-advice-postgresql-19 Read discussion |