Re: pg_plan_advice
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Matheus Alcantara <matheusssilv97@gmail.com>
Cc: Jakub Wartak <jakub.wartak@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-17T15:09:36Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add pg_plan_advice contrib module.
- 5883ff30b02c 19 (unreleased) landed
-
Store information about Append node consolidation in the final plan.
- 7358abcc6076 19 (unreleased) landed
-
Store information about elided nodes in the final plan.
- 0d4391b265f8 19 (unreleased) landed
-
Store information about range-table flattening in the final plan.
- adbad833f3d9 19 (unreleased) landed
-
Allow for plugin control over path generation strategies.
- 4020b370f214 19 (unreleased) landed
-
Allow passing a pointer to GetNamedDSMSegment()'s init callback.
- 48d4a1423d2e 19 (unreleased) cited
-
Don't reset the pathlist of partitioned joinrels.
- 014f9a831a32 19 (unreleased) cited
On Mon, Nov 17, 2025 at 9:42 AM Matheus Alcantara <matheusssilv97@gmail.com> wrote: > I've spent some time playing with these patches. I still don't have to > much comments on the syntax yet but I've noticed a small bug or perhaps > I'm missing something? Cool, thanks for looking. I am guessing that the paucity of feedback thus far is partly because there's a lot of stuff to absorb -- though the main point at this stage is really to get some opinions on the planner infrastructure/hooks, which don't necessarily require full understanding of (never mind agreement with) the design of pg_plan_advice itself. > When I run CREATE EXTENSION pg_plan_advice I'm able to use the > EXPLAIN(plan_advice) but if try to open another connection, with the > extension already previously created, I'm unable to use once I drop and > re-create the extension. This is just an idiosyncrasy of PostgreSQL's extension framework. Whether or not EXPLAIN (PLAN_ADVICE) works depends on whether the shared module has been loaded, not whether the extension has been created. The purpose of CREATE EXTENSION is to put SQL objects, such as function definitions, into the database, but there's no SQL required to enable EXPLAIN (PLAN_ADVICE) -- or for setting the pg_plan_advice.advice GUC. However, running CREATE EXTENSION to establish the function definitions will incidentally load the shared module into that particular session. Therefore, the best way to use this module is to add pg_plan_advice to shared_preload_libraries. Alternatively, you can use session_preload_libraries or run LOAD in an individual session. If you don't care about the collector interface, that's really all you need. If you do care about the collector interface, then in addition you will need to run CREATE EXTENSION, so that the SQL functions needed to access it are available. -- Robert Haas EDB: http://www.enterprisedb.com