Re: Change in CTE treatment in query plans?

From: David Conlin <dc345(at)cantab(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Change in CTE treatment in query plans?
Date: 2019-10-21 13:22:01
Message-ID: a2e0867f-ef98-471a-c2bf-2184d304f76c@cantab.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi Tom -

Thanks so much for getting back to me.

I didn't realise that the costs of init/sub plans would be spread across
the call sites - I had (stupidly) assumed that each call site would
include the full cost.

Having taken a couple of days to go back over the problems I was seeing,
you were absolutely right - it was all to do with multiple call sites -
the postgres version was just a red herring.

Thanks for your help & all the best,

Dave

On 17/10/2019 10:04, Tom Lane wrote:
> David Conlin <dc345(at)cantab(dot)net> writes:
>> Does anyone know if there's been a change in the way values for CTEs are
>> displayed in query plans?
> Offhand I don't recall any such changes, nor does a cursory look
> through explain.c find anything promising.
>
> If you're concerned with a multiply-referenced CTE, one possibility
> for funny results is that the blame for its execution cost could be
> spread across the multiple call sites. The same can happen with
> initplans/subplans. But I'm just guessing; you didn't show any
> concrete examples so it's hard to be definite.
>
> regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Joao Junior 2019-10-22 12:28:31 max_connections
Previous Message Justin Pryzby 2019-10-18 16:15:02 Re: Can you please tell us how set this prefetch attribute in following lines.