Date: 2025-05-14
Time: 16:30–16:55
Room: Breakout Room 1
Level: Intermediate
In this session I'll share an overview of my recently proposed patch to introduce plan ID tracking into Postgres (similar to query ID tracking), and how it enables aggregate analysis of which query used which plan structure. We'll also discuss which parts of a plan should be considered significant, and how to deal with special cases such as partitioning (which can lead to many unique plan IDs), and which parts of this could be done better in-core, vs an extension.
This session and patch set is based on my experience helping users improve query plans over many years as part of the pganalyze product - I'll also compare how the proposed patch relates to previous approaches, including the pg_stat_plans and pg_store_plans open-source extensions, as well as proprietary implementations by cloud providers that I'm familiar with as a user.
I'll also review an example implementation of a new pg_stat_plans, that uses the (now extensible) cumulative statistics system to track statistics and plan texts in shared memory, and how this may be useful for a future improved pg_stat_statements as well.