Re: track generic and custom plans in pg_stat_statements

Sami Imseih <samimseih@gmail.com>

From: Sami Imseih <samimseih@gmail.com>
To: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>
Cc: Greg Sabino Mullane <htamfids@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-04-08T11:56:53Z
Lists: pgsql-hackers
> After the introduction of pg_overexplain extension and Robert's comment
> [0], I'm starting to have doubts about whether it's still appropriate to
> add this information to EXPLAIN itself. If there are compelling reasons
> that showing the plan type would be broadly useful to users in EXPLAIN,
> I’m happy to proceed. Otherwise, perhaps this is something better suited
> for extension.
>
> [0]:
>
> https://www.postgresql.org/message-id/CA%2BTgmoZ8qXiZmmn4P9Mk1cf2mjMMLFPOjSasCjuKSiHFcm-ncw%40mail.gmail.com


Yes, pg_overexplain can be used for the explain, and we
may not even need it at all since generic plans
are already displayed with $1, $2 parameters.

Let me know if you have other comments for v5, the
pg_stat_statements enhancements.


—
Sami Imseih
Amazon Web Services (AWS)

Commits

  1. pg_stat_statements: Add counters for generic and custom plans

  2. Rename CachedPlanType to PlannedStmtOrigin for PlannedStmt

  3. Introduce field tracking cached plan type in PlannedStmt