From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Guo <guofenglinux(at)gmail(dot)com> |
Cc: | Jian Guo <gjian(at)vmware(dot)com>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Hans Buschmann <buschmann(at)nidsa(dot)net>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Zhenghua Lyu <zlyu(at)vmware(dot)com> |
Subject: | Re: Wrong rows estimations with joins of CTEs slows queries by more than factor 500 |
Date: | 2023-11-17 03:53:31 |
Message-ID: | c7d386a5042b074f7228c9b47b2774b1239ba54c.camel@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 2023-11-16 at 22:38 -0500, Tom Lane wrote:
> That line of argument also leads to the conclusion that it'd be
> okay to expose info about the ordering of the CTE result to the
> upper planner. [...] The fence is sort of one-way
> in this line of thinking: information can propagate up to the outer
> planner level, but not down into the CTE plan.
>
> Thoughts?
That agrees with my intuition about MATERIALIZED CTEs.
I think of them as "first calculate the CTE, then calculate the
rest of the query" or an ad-hoc temporary table for the duration
of a query. I would expect the upper planner to know estimates
and other data about the result of the CTE.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2023-11-17 04:18:11 | Use of backup_label not noted in log |
Previous Message | David G. Johnston | 2023-11-17 03:45:44 | Re: Wrong rows estimations with joins of CTEs slows queries by more than factor 500 |