Re: POC: GROUP BY optimization - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: POC: GROUP BY optimization
Date
Msg-id CAPpHfdvnpQ_78_bW8TQU_j64haz9WGOYS3Zx=5tw70ge7c_eWA@mail.gmail.com
Whole thread Raw
In response to Re: POC: GROUP BY optimization  (Andrei Lepikhov <a.lepikhov@postgrespro.ru>)
Responses Re: POC: GROUP BY optimization  (Andrei Lepikhov <a.lepikhov@postgrespro.ru>)
List pgsql-hackers
On Thu, Dec 28, 2023 at 10:22 AM Andrei Lepikhov
<a.lepikhov@postgrespro.ru> wrote:
> But arrangement with an ORDER BY clause doesn't work:
>
> DROP INDEX abc;
> explain SELECT x,w,z FROM t GROUP BY (w,x,z) ORDER BY (x,z,w);
>
> I think the reason is that the sort_pathkeys and group_pathkeys are
> physically different structures, and we can't just compare pointers here.

I haven't yet looked into the code.  But this looks strange to me.
Somehow, optimizer currently matches index pathkeys to ORDER BY
pathkeys.  If GROUP BY pathkeys could be matched to index pathkeys,
then it should be possible to match them to ORDER BY pathkeys too.


------
Regards,
Alexander Korotkov



pgsql-hackers by date:

Previous
From: Shinya Kato
Date:
Subject: Re: Set log_lock_waits=on by default
Next
From: Robins Tharakan
Date:
Subject: Re: pg_upgrade failing for 200+ million Large Objects