From: | Vik Fearing <vik(at)postgresfriends(dot)org> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | GROUP BY DISTINCT |
Date: | 2021-02-21 12:52:24 |
Message-ID: | bf3805a8-d7d1-ae61-fece-761b7ff41ecc@postgresfriends.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs pgsql-hackers |
When combining multiple grouping items, such as rollups and cubes, the
resulting flattened grouping sets can contain duplicate items. The
standard provides for this by allowing GROUP BY DISTINCT to deduplicate
them prior to doing the actual work.
For example:
GROUP BY ROLLUP (a,b), ROLLUP (a,c)
expands to the sets:
(a,b,c), (a,b), (a,b), (a,c), (a), (a), (a,c), (a), ()
but:
GROUP BY DISTINCT ROLLUP (a,b), ROLLUP (a,c)
expands to just the sets:
(a,b,c), (a,b), (a,c), (a), ()
Attached is a patch to implement this for PostgreSQL.
--
Vik Fearing
Attachment | Content-Type | Size |
---|---|---|
0001-implement-GROUP-BY-DISTINCT.v01.patch | text/x-patch | 19.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | er | 2021-02-21 14:06:03 | Re: GROUP BY DISTINCT |
Previous Message | Michael Paquier | 2021-02-21 06:58:59 | Re: Inaccuracy in wal_receiver_status_interval parameter description |
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Fan | 2021-02-21 13:33:38 | Re: Extend more usecase for planning time partition pruning and init partition pruning. |
Previous Message | Dilip Kumar | 2021-02-21 12:03:50 | Re: [HACKERS] Custom compression methods |