Re: Make EXPLAIN generate a generic plan for a parameterized query - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: Make EXPLAIN generate a generic plan for a parameterized query
Date
Msg-id 20221011160348.dptd53h4bfg7cv5v@jrouhaud
Whole thread Raw
In response to Re: Make EXPLAIN generate a generic plan for a parameterized query  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Make EXPLAIN generate a generic plan for a parameterized query  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-hackers
On Tue, Oct 11, 2022 at 09:49:14AM -0400, Tom Lane wrote:
>
> If you're trying to investigate custom-plan behavior, then you
> need to supply concrete parameter values somewhere, so I think
> this approach is fine for that case.  (Shoehorning parameter
> values into EXPLAIN options seems like it'd be a bit much.)
> However, investigating generic-plan behavior this way is tedious,
> since you have to invent irrelevant parameter values, plus mess
> with plan_cache_mode or else run the explain half a dozen times.
> So I can get behind having a more convenient way for that.

One common use case is tools identifying a slow query using pg_stat_statements,
identifying some missing indexes and then wanting to check whether the index
should be useful using some hypothetical index.

FTR I'm working on such a project and for now we have to go to great lengths
trying to "unjumble" such queries, so having a way to easily get the answer for
a generic plan would be great.



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Expand palloc/pg_malloc API
Next
From: Tom Lane
Date:
Subject: Re: Expand palloc/pg_malloc API