Re: CTE push down

2021-04-23 Thread Alexander Pyhalov
Ashutosh Bapat писал 2021-04-14 16:01: On Tue, Apr 13, 2021 at 6:58 PM Alexander Pyhalov wrote: I believe step2 is needed to avoid materializing rows which will never be selected. That would be a good improvement. However, care needs to be taken for volatile quals. I think, the quals on CTE w

Re: CTE push down

2021-04-14 Thread Ashutosh Bapat
On Tue, Apr 13, 2021 at 6:58 PM Alexander Pyhalov wrote: > > Hi. > > Currently PostgreSQL supports CTE push down for SELECT statements, but > it is implemented as turning each CTE reference into subquery. > > When CTE is referenced multiple times, we have choice - to m

CTE push down

2021-04-13 Thread Alexander Pyhalov
Hi. Currently PostgreSQL supports CTE push down for SELECT statements, but it is implemented as turning each CTE reference into subquery. When CTE is referenced multiple times, we have choice - to materialize CTE (and disable quals distribution to the CTE query) or inline it (and so run CTE