Re: Make EXPLAIN generate a generic plan for a parameterized query

From: Michel Pelletier <pelletier(dot)michel(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Make EXPLAIN generate a generic plan for a parameterized query
Date: 2022-12-27 22:37:11
Message-ID: CACxu=vKjLyV4HZjtEoUpXMdRDKdF9D6_VWxyNoTwXd0tLAmK=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 7, 2022 at 3:23 AM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
wrote:

> On Tue, 2022-12-06 at 10:17 -0800, Andres Freund wrote:
> > On 2022-10-29 10:35:26 +0200, Laurenz Albe wrote:
> > > > > Here is a patch that
> > > > > implements it with an EXPLAIN option named GENERIC_PLAN.
> >
> > This fails to build the docs:
> >
> > https://cirrus-ci.com/task/5609301511766016
> >
> > [17:47:01.064] ref/explain.sgml:179: parser error : Opening and ending
> tag mismatch: likeral line 179 and literal
> > [17:47:01.064] <likeral>ANALYZE</literal>, since a statement with
> unknown parameters
> > [17:47:01.064] ^
>
> *blush* Here is a fixed version.
>

I built and tested this patch for review and it works well, although I got
the following warning when building:

analyze.c: In function 'transformStmt':
analyze.c:2919:35: warning: 'generic_plan' may be used uninitialized in
this function [-Wmaybe-uninitialized]
2919 | pstate->p_generic_explain = generic_plan;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
analyze.c:2909:25: note: 'generic_plan' was declared here
2909 | bool generic_plan;
| ^~~~~~~~~~~~

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-12-27 22:45:30 Re: recovery modules
Previous Message Zheng Li 2022-12-27 22:32:59 Re: Support logical replication of DDLs