Is it useful to record whether plans are generic or custom?

From: Atsushi Torikoshi <atorik(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Is it useful to record whether plans are generic or custom?
Date: 2020-05-12 04:53:15
Message-ID: CACZ0uYHZ4M=NZpofH6JuPHeX=__5xcDELF8hT8_2T+R55w4RQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

When we run prepared statements, as far as I know, running
EXPLAIN is the only way to know whether executed plans are
generic or custom.
There seems no way to know how many times a prepared
statement was executed as generic and custom.

I think it may be useful to record the number of generic
and custom plans mainly to ensure the prepared statements
are executed as expected plan type.
If people also feel it's useful, I'm going to think about adding
columns such as 'generic plans' and 'custom plans' to
pg_stat_statements.

As you know, pg_stat_statements can now track not only
'calls' but 'plans', so we can presume which plan type
was executed from them.
When both 'calls' and 'plans' were incremented, plan
type would be custom. When only 'calls' was incremented,
it would be generic.
But considering the case such as only the plan phase has
succeeded and the execution phase has failed, this
presumption can be wrong.

Thoughts?

Regards,

--
Atsushi Torikoshi

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2020-05-12 04:57:49 Re: [PATCH] hs_standby_disallowed test fix
Previous Message Amit Kapila 2020-05-12 04:12:33 Re: Parallel copy