Re: CTE Materialization

2021-12-10 Thread Richard Michael
On Thu, 9 Dec 2021 at 10:29, Paul van der Linden wrote: > This one quite nicely explains it: > https://stackoverflow.com/questions/14897816/how-can-i-prevent-postgres-from-inlining-a-subquery > Given indexes applicable to multiple expressions in a WHERE condition, how does postgres decide which

Re: How to observe plan_cache_mode transition from custom to generic plan?

2021-09-10 Thread Richard Michael
On Fri, Sep 10, 2021 at 10:38 AM Laurenz Albe wrote: > On Thu, 2021-09-09 at 16:51 +0200, Richard Michael wrote: > > > > 2/ EXPLAIN EXECUTE of prepared statement doesn't show query text, as > the > > > > documentation seems to imply. Should it? > > &g

Re: How to observe plan_cache_mode transition from custom to generic plan?

2021-09-10 Thread Richard Michael
On Thu, Sep 9, 2021 at 7:39 PM Tom Lane wrote: > Richard Michael writes: > > Would a tiny patch to the PREPARE docs be accepted? I'd like to help > > clarify investigating `plan_cache_mode` for future readers. > > What did you have in mind? > > (I'm kin

Re: How to observe plan_cache_mode transition from custom to generic plan?

2021-09-09 Thread Richard Michael
Hi Tom, On Thu, Sep 9, 2021 at 6:02 PM Tom Lane wrote: > Richard Michael writes: > > After reading Laurenz's reply, I experimented again with `PREPARE > > basic(int) AS SELECT $1 AS number;" and the query plan logged in the log > > file (by auto_explain) does

Re: How to observe plan_cache_mode transition from custom to generic plan?

2021-09-09 Thread Richard Michael
Hi David, On Sun, Sep 5, 2021 at 8:32 PM David G. Johnston wrote: > On Sunday, September 5, 2021, Richard Michael > wrote: > >> >> Based on the documentation, I expected the first planned query text to >> be: `SELECT 10 AS data`, since it should be a custom plan

Re: How to observe plan_cache_mode transition from custom to generic plan?

2021-09-09 Thread Richard Michael
Hi Laurenz, Thank you for the quick response and clear demonstration. I have a few comments, inline below. On Mon, Sep 6, 2021 at 8:26 AM Laurenz Albe wrote: > On Sun, 2021-09-05 at 14:20 -0400, Mladen Gogala wrote: > > On 9/5/21 9:35 AM, Richard Michael wrote: > > > TL;D

How to observe plan_cache_mode transition from custom to generic plan?

2021-09-05 Thread Richard Michael
TL;DR -- 1/ My basic prepared statement doesn't seem to start out with a custom plan (i.e., no parameter symbols in query text). 2/ EXPLAIN EXECUTE of prepared statement doesn't show query text, as the documentation seems to imply. Should it? 3/ How can I observe the effect of plan_cache_mode?