postgresql/src
Tomas Vondra be45be9c33 Implement GROUP BY DISTINCT
With grouping sets, it's possible that some of the grouping sets are
duplicate.  This is especially common with CUBE and ROLLUP clauses. For
example GROUP BY CUBE (a,b), CUBE (b,c) is equivalent to

  GROUP BY GROUPING SETS (
    (a, b, c),
    (a, b, c),
    (a, b, c),
    (a, b),
    (a, b),
    (a, b),
    (a),
    (a),
    (a),
    (c, a),
    (c, a),
    (c, a),
    (c),
    (b, c),
    (b),
    ()
  )

Some of the grouping sets are calculated multiple times, which is mostly
unnecessary.  This commit implements a new GROUP BY DISTINCT feature, as
defined in the SQL standard, which eliminates the duplicate sets.

Author: Vik Fearing
Reviewed-by: Erik Rijkers, Georgios Kokolatos, Tomas Vondra
Discussion: https://postgr.es/m/bf3805a8-d7d1-ae61-fece-761b7ff41ecc@postgresfriends.org
2021-03-18 18:22:18 +01:00
..
backend Implement GROUP BY DISTINCT 2021-03-18 18:22:18 +01:00
bin Add a new GUC and a reloption to enable inserts in parallel-mode. 2021-03-18 07:25:27 +05:30
common pg_upgrade: Check version of target cluster binaries 2021-03-03 09:45:56 +01:00
fe_utils Refactor and generalize the ParallelSlot machinery. 2021-03-11 13:17:46 -05:00
include Implement GROUP BY DISTINCT 2021-03-18 18:22:18 +01:00
interfaces Implement pipeline mode in libpq 2021-03-15 18:13:42 -03:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Remove extra increment of plpgsql's statement counter for FOR loops. 2021-02-02 14:35:12 -05:00
port Add missing pthread_barrier_t. 2021-03-10 17:44:04 +13:00
template Further tweaking of PG_SYSROOT heuristics for macOS. 2021-01-20 12:07:23 -05:00
test Implement GROUP BY DISTINCT 2021-03-18 18:22:18 +01:00
timezone Update time zone data files to tzdata release 2021a. 2021-01-24 16:29:47 -05:00
tools Add a new GUC and a reloption to enable inserts in parallel-mode. 2021-03-18 07:25:27 +05:30
tutorial tutorial: land height is "elevation", not "altitude" 2021-03-10 20:25:19 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Introduce --with-ssl={openssl} as a configure option 2021-02-01 19:19:44 +09:00
Makefile.shlib Add PostgreSQL home page to --help output 2020-02-28 13:12:21 +01:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00