Re: making EXPLAIN extensible
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Andrei Lepikhov <lepihov@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-03-04T14:23:55Z
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 →
-
pg_overexplain: Use PG_MODULE_MAGIC_EXT.
- 83ccc85859f3 18.0 landed
-
pg_overexplain: Call previous hooks as appropriate.
- 9f0c36aea0fb 18.0 landed
-
pg_overexplain: Additional EXPLAIN options for debugging.
- 8d5ceb113e3f 18.0 landed
-
Add an additional hook for EXPLAIN option validation.
- 50ba65e73325 18.0 landed
-
Add some new hooks so extensions can add details to EXPLAIN.
- 4fd02bf7cf94 18.0 landed
-
Make it possible for loadable modules to add EXPLAIN options.
- c65bc2e1d14a 18.0 landed
On Tue, Mar 4, 2025 at 8:56 AM Andrei Lepikhov <lepihov@gmail.com> wrote: > Passing through the patches, I would say that changing the order of 0001 > and 0002 would make them more independent. Hmm, I thought this order made sense, but I could reorder them if there's some compelling reason to do so. If there's no particularly compelling reason, it would be less work to commit them in this order. > Also, I'm ok with the floating order of extension messages in the > explain output. We get used to living with dependencies on extension > load order (pg_stat_statements quite annoyingly impacts queryid, for > example), and this issue should be solved generally, in my opinion. I've often thought that the solution to this class of problems could be to have extensions not manipulate a hook variable directly, but instead call a function to which they pass their callback function and an integer priority. Then we could call hook functions in priority order. One difficulty is that this requires extension authors to agree on what the priority order should be. In some cases that might not be too hard, but it isn't apparent how it would work here. IMHO, it's reasonable for the author of an EXPLAIN extension to say "well, I see Robert already created an extension with an option called DEBUG, so I will name my option TROUBLESHOOT," or something of that sort. But if Robert gave the DEBUG hook priority 50, should I also give my hook priority 50, or should I make it 40 or 25 or 1 or 100 or what? Even if I know about all of the other extensions it's not really clear what I should do. Actually, in this case, it feels like it would be better if the user could control the ordering somehow, but I feel like that might be over-engineering. > I support the way where extensions are allowed to print info but not > restructure or remove something. > Wait for the commit! Cool, thanks. -- Robert Haas EDB: http://www.enterprisedb.com