Hi,
Currently, EXPLAIN is the only way to know whether the plan is generic or custom according to the manual of PREPARE.
https://www.postgresql.org/docs/devel/sql-prepare.htmlAfter commit d05b172, we can also use pg_prepared_statements view to examine the plan types.
How about adding this explanation like the attached patch? Regards, -- Atsushi Torikoshi
From 2c8f66637075fcb2f802a2b9cfd354f2efbbbb18 Mon Sep 17 00:00:00 2001 From: Atsushi Torikoshi <torikos...@oss.nttdata.com> Date: Thu, 12 Nov 2020 17:00:19 +0900 Subject: [PATCH v1] After commit d05b172, we can use pg_prepared_statements view to examine whether the plan is generic or custom. This patch adds this explanation in the manual of PREPARE. --- doc/src/sgml/ref/prepare.sgml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/src/sgml/ref/prepare.sgml b/doc/src/sgml/ref/prepare.sgml index 57a34ff83c..2268c222a9 100644 --- a/doc/src/sgml/ref/prepare.sgml +++ b/doc/src/sgml/ref/prepare.sgml @@ -179,6 +179,13 @@ EXPLAIN EXECUTE <replaceable>name</replaceable>(<replaceable>parameter_values</r documentation. </para> + <para> + To examine how many times each prepared statement chose generic and + custom plan cumulatively in the current session, refer + <link linkend="view-pg-prepared-statements"><structname>pg_prepared_statements</structname></link> + system view. + </para> + <para> Although the main point of a prepared statement is to avoid repeated parse analysis and planning of the statement, <productname>PostgreSQL</productname> will -- 2.18.1