Re: CTE materialized/not materialized - Mailing list pgsql-sql

From Tom Lane
Subject Re: CTE materialized/not materialized
Date
Msg-id 704895.1606491302@sss.pgh.pa.us
Whole thread Raw
In response to RE: CTE materialized/not materialized  ("Voillequin, Jean-Marc" <Jean-Marc.Voillequin@moodys.com>)
Responses RE: CTE materialized/not materialized
List pgsql-sql
"Voillequin, Jean-Marc" <Jean-Marc.Voillequin@moodys.com> writes:
> Let me rephrase.
> In the case the CTE can be inlined, why PG does not compute 2 plans (P1 with CTE inlined, P2 with CTE materialized)
andcompare them to choose the best? 

It would be excessively expensive (even for just one CTE, never mind
several) and it wouldn't fit into the planner's structure very well.
As noted in the comment Alvaro quoted, the point where we make these
decisions is pretty far upstream of having any concrete cost estimates.

            regards, tom lane



pgsql-sql by date:

Previous
From: "Voillequin, Jean-Marc"
Date:
Subject: RE: CTE materialized/not materialized
Next
From: "Voillequin, Jean-Marc"
Date:
Subject: RE: CTE materialized/not materialized