Re: Propagate pathkeys from CTEs up to the outer query

From: Andrei Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: Richard Guo <guofenglinux(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Propagate pathkeys from CTEs up to the outer query
Date: 2024-02-14 06:18:02
Message-ID: fca8fe78-c67a-48ac-9164-60138e122f6c@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 29/1/2024 10:18, Richard Guo wrote:
> In [1] we've reached a conclusion that for a MATERIALIZED CTE it's okay
> to 'allow our statistics or guesses for the sub-query to subsequently
> influence what the upper planner does'.  Commit f7816aec23 exposes
> column statistics to the upper planner.  In the light of that, here is a
> patch that exposes info about the ordering of the CTE result to the
> upper planner.
>
> This patch was initially posted in that same thread and has received
> some comments from Tom in [2].  Due to the presence of multiple patches
> in that thread, it has led to confusion.  So fork a new thread here
> specifically dedicated to discussing the patch about exposing pathkeys
> from CTEs to the upper planner.
I like this approach. It looks good initially, but such features need
more opinions/views/time to analyse corner cases.
It goes alongside my current backburner - pull parameterisation through
the GROUP-BY and the query block fence up to the JOIN searching code of
the parent query.

--
regards,
Andrei Lepikhov
Postgres Professional

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message torikoshia 2024-02-14 06:29:35 Re: RFC: Logging plan of the running query
Previous Message Ian Lawrence Barwick 2024-02-14 05:22:10 Re: Allow passing extra options to initdb for tests