Re: Maintain the pathkesy for subquery from outer side information

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Maintain the pathkesy for subquery from outer side information
Date: 2021-07-24 14:19:32
Message-ID: CAKU4AWpVQN+XGa4ckcNF-VZxMfqpQUvMiRk8y5nRtWTM-xWH0g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jul 24, 2021 at 10:14 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> writes:
> > When I am working on the UnqiueKey stuff, I find the following cases.
> > SELECT * FROM (SELECT * FROM t offset 0) v ORDER BY a;
> > // root->query_keys = A. root->order_pathkeys = A
> > // Current: subroot->query_pathkeys = NIL.
> > // Expected: subroot->xxxx_pathkeys = [A].
>
> Why do you "expect" that? I think pushing the outer ORDER BY past a
> LIMIT is an unacceptable semantics change.
>
> regards, tom lane

I don't mean push down a "ORDER BY" clause to subquery, I mean push
down an "interesting order" to subquery. for example we have index t(a);
then SELECT * FROM (SELECT a FROM t OFFSET 0) v ORDER BY a;
In the current implementation, when we are planning the subuqery, planners
think the "pathkey a" is not interesting, but it should be IIUC.

--
Best Regards
Andy Fan (https://www.aliyun.com/)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-07-24 14:34:34 Re: Maintain the pathkesy for subquery from outer side information
Previous Message Tom Lane 2021-07-24 14:14:41 Re: Maintain the pathkesy for subquery from outer side information