# pg\_plan\_advice

Published articles for pg\_plan\_advice.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Plan Advice in PostgreSQL 19

DevFeed: [Plan Advice in PostgreSQL 19](<https://devfeed.tech/articles/plan-advice-in-postgresql-19-34622.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2026/09/plan-advice-in-postgresql-19/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2026-09-15T16:27:53Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [version](<https://devfeed.tech/topics/version.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Docker Compose](<https://devfeed.tech/topics/docker-compose.md>)

Tags: [analyze](<https://devfeed.tech/tags/analyze.md>), [beta](<https://devfeed.tech/tags/beta.md>), [docker-compose](<https://devfeed.tech/tags/docker-compose.md>), [pg-plan-advice](<https://devfeed.tech/tags/pg-plan-advice.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [sql](<https://devfeed.tech/tags/sql.md>)

### AI overview

This tutorial explains PostgreSQL 19's pg_plan_advice and pg_stash_advice modules, which represent query-plan decisions as reusable advice and can apply that advice by query ID. It also describes reconstructing comparable plan advice from ordinary plan output on earlier PostgreSQL versions.

### Source excerpt

There is a conversation that happens in every PostgreSQL shop eventually. A query that has been fine for a year gets slow overnight. Nothing was deployed. The data grew a little, ANALYZE ran, and the planner -- entirely reasonably, on the numbers it had -- picked a different plan. The old plan was better. You would like it back. PostgreSQL 19 ships two new modules for exactly this: pg_plan_advice, which can read a plan back out as a string and enforce it later, and pg_stash_advice, which keeps those strings keyed by query id and applies them automatically. ▸ Every query below ran against the Lab, the free dataset bundle used throughout this blog, on PostgreSQL 19 Beta 3: POSTGRES_VERSION=19beta3 PG_MAJOR=19 docker compose up. Both modules are contrib, and the Lab image ships them; nothing below runs a LOAD to enable them, because the server already has them -- pg_plan_advice in session_preload_libraries, pg_stash_advice in shared_preload_libraries (it can survive a restart, which needs loading that way). One line each in postgresql.conf, or the equivalent server-start flag, and you're done. pg_stash_advice still needs its own CREATE EXTENSION, further down, for its SQL functions -- that's independent of how the module itself got loaded.

## Waiting for PostgreSQL 19 - Add pg\_plan\_advice contrib module.

DevFeed: [Waiting for PostgreSQL 19 - Add pg\_plan\_advice contrib module.](<https://devfeed.tech/articles/waiting-for-postgresql-19-add-pg-plan-advice-contrib-module-33682.md>)

Original publisher: [Read original article](<https://www.depesz.com/2026/03/22/waiting-for-postgresql-19-add-pg_plan_advice-contrib-module/>)

Author: depesz

Published: 2026-03-22T13:44:10Z

Content type: tutorial

Language: en

Sources: [select \* from depesz;](<https://devfeed.tech/sources/select-from-depesz.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [systems](<https://devfeed.tech/topics/systems.md>)

Tags: [advice](<https://devfeed.tech/tags/advice.md>), [hint](<https://devfeed.tech/tags/hint.md>), [module](<https://devfeed.tech/tags/module.md>), [pg-plan-advice](<https://devfeed.tech/tags/pg-plan-advice.md>), [pg19](<https://devfeed.tech/tags/pg19.md>), [plan](<https://devfeed.tech/tags/plan.md>), [planner](<https://devfeed.tech/tags/planner.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [statistics](<https://devfeed.tech/tags/statistics.md>), [uncategorized](<https://devfeed.tech/tags/uncategorized.md>), [waiting](<https://devfeed.tech/tags/waiting.md>)

### AI overview

This article examines PostgreSQL's proposed pg_plan_advice contrib module, explaining why query planners sometimes choose suboptimal plans, how plan hints could stabilize or override those choices, and how to load and test the extension.

### Source excerpt

On 12nd of March 2026, Robert Haas committed patch: Add pg_plan_advice contrib module. Provide a facility that (1) can be used to stabilize certain plan choices so that the planner cannot reverse course without authorization and (2) can be used by knowledgeable users to insist on plan choices contrary to what the planner believes ... Continue reading "Waiting for PostgreSQL 19 - Add pg_plan_advice contrib module."