Re: Preserve presorted ORDER BY keys when reordering DISTINCT ON keys

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: Chengpeng Yan <chengpeng_yan(at)outlook(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Preserve presorted ORDER BY keys when reordering DISTINCT ON keys
Date: 2026-11-29 01:56:12
Message-ID: CAHewXNkHWGMZ3LF6btNhic0kc=npRA=_Ltq+GPLP3=u7uLGSQg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Chengpeng Yan <chengpeng_yan(at)outlook(dot)com> 于2026年11月25日周三 21:09写道:
> Thanks for working on this. I reviewed v1 and it looks good to me. I
> wonder if it's worth adding a negative test with an index on (x, y, w
> DESC, z DESC) and a query with ORDER BY y, x, z DESC, w DESC. If the
> plan uses that index, it should still sort before Unique to pick the
> right row.
>
> Also, please run pgindent.
>

Done as attached v2.

--
Tender Wang

Attachment Content-Type Size
v2-0001-Preserve-presorted-ORDER-BY-keys-when-reordering-.patch text/plain 12.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-11-29 03:47:37 Re: Two fixes for parallel query cleanup: DSM detach order and a stray statement timeout
Previous Message Robert Haas 2026-11-29 01:53:01 Re: RFC: Logging plan of the running query