Re: Skip a redundant singleton GROUP BY node

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: zengxx <xiangxin_zeng(at)qq(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Skip a redundant singleton GROUP BY node
Date: 2026-10-09 00:41:24
Message-ID: CAApHDvo8aZdjZpTeQbPF+yNEYAsJt-HMH6h=M=9o6grfeM-8hA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 9 Oct 2026 at 13:23, zengxx <xiangxin_zeng(at)qq(dot)com> wrote:
> This two-patch series avoids a plain GROUP BY step when the planner can
> prove that every input row already forms its own group.

It seems you're opening a new thread about this every week. Please do
not do this. It will fragment any discussion and make things harder to
follow. It also causes unnecessary traffic on the mailing lists.

3 threads:
18th Sept: https://www.postgresql.org/message-id/flat/tencent_4DDFEE26EA4A2E1BA967729AF20822D61207%40qq.com
24th Sept: https://www.postgresql.org/message-id/flat/tencent_1D9637E157D2D9043FE7D28C443CB036FB0A%40qq.com
today: https://www.postgresql.org/message-id/flat/tencent_F52C0D4C4415EB90AF70934BE597CDCDB306%40qq.com

The correct procedure for ensuring patches do not get forgotten is to
add them in the commitfest app [0].

For this one, I wouldn't bother as the idea gets proposed regularly on
this mailing list. Please research the previous proposals. For example
[1].

> The proof is deliberately narrow. The input must be a single ordinary base
> relation or partitioned table. For a partitioned table, the unique index
> must include the partition key, so covering it in the grouping key proves
> cross-partition uniqueness as well.

See discussions in [2]. There also seems to already be a patch in the
commitfest for this; see [3]

David

[0] https://commitfest.postgresql.org/
[1] https://postgr.es/m/CAKU4AWpxABop1ydF-478NXjObG8r-g2yy0=E1i2bf88HvjS04g@mail.gmail.com
[2] https://postgr.es/m/CAApHDvq7i0%3DO97r4Y1pv68%2BtprVczKsXRsV28rM9H-rVPOfeNQ%40mail.gmail.com
[3] https://commitfest.postgresql.org/patch/7045/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message zengxx 2026-10-09 00:48:54 Re: Skip a redundant singleton GROUP BY node
Previous Message zengxx 2026-10-09 00:22:48 Skip a redundant singleton GROUP BY node