Re: Reordering DISTINCT keys to match input path's pathkeys

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reordering DISTINCT keys to match input path's pathkeys
Date: 2024-01-23 09:03:23
Message-ID: CAApHDvq39jp0EXbtu0Kwx7um_x54MiFcKx2sNj9kdTc9TEYu7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 23 Jan 2024 at 18:56, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
> Similar to what we did to GROUP BY keys in 0452b461bc, I think we can do
> the same to DISTINCT keys, i.e. reordering DISTINCT keys to match input
> path's pathkeys, which can help reduce cost by avoiding unnecessary
> re-sort, or allowing us to use incremental-sort to save efforts. For
> instance,

I've not caught up on the specifics of 0452b461b, but I just wanted to
highlight that there was some work done in [1] in this area. It seems
Ankit didn't ever add that to a CF, so that might explain why it's
been lost.

Anyway, just pointing it out as there may be useful code or discussion
in the corresponding threads.

David

[1] https://postgr.es/m/da9425ae-8ff7-33d9-23b3-2a3eb605e106%40gmail.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ajin Cherian 2024-01-23 09:07:50 Re: Synchronizing slots from primary to standby
Previous Message Michael Zhilin 2024-01-23 08:59:00 Re: Shared detoast Datum proposal