> Thank you for your patch. It is really useful for tracking the history > of generic and custom plan usage.
Thanks for the review! > 1. Is there any reason for the double check of cplan != NULL? It seems > unnecessary, and we could simplify it to: > > -if (cplan && cplan->status == PLAN_CACHE_STATUS_CUSTOM_PLAN) > +if (cplan->status == PLAN_CACHE_STATUS_CUSTOM_PLAN) No, it's not necessary and an oversight. removed. > 2. Should we add Assert(kind == PGSS_EXEC) at this place to ensure that > generic_plan_calls and custom_plan_calls are only incremented when > appropriate? > I don't think an assert is needed here. There is an assert at the start of the block for PGSS_EXEC and PGSS_PLAN, but cplan is only available in the executor. v4 attached -- Sami
v4-0001-add-plan_cache-counters-to-pg_stat_statements.patch
Description: Binary data