git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: cd91de0) | patch
Implement GROUP BY DISTINCT
2021年3月18日 16:45:38 +0000 (17:45 +0100)
2021年3月18日 17:22:18 +0000 (18:22 +0100)
commit be45be9c33a85e72cdaeb9967e9f6d2d00199e09
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
18 files changed:
doc/src/sgml/queries.sgml diff | blob | blame | history
doc/src/sgml/ref/select.sgml diff | blob | blame | history
src/backend/catalog/sql_features.txt diff | blob | blame | history
src/backend/nodes/copyfuncs.c diff | blob | blame | history
src/backend/nodes/equalfuncs.c diff | blob | blame | history
src/backend/nodes/list.c diff | blob | blame | history
src/backend/nodes/outfuncs.c diff | blob | blame | history
src/backend/nodes/readfuncs.c diff | blob | blame | history
src/backend/optimizer/plan/planner.c diff | blob | blame | history
src/backend/parser/analyze.c diff | blob | blame | history
src/backend/parser/gram.y diff | blob | blame | history
src/backend/parser/parse_agg.c diff | blob | blame | history
src/backend/utils/adt/ruleutils.c diff | blob | blame | history
src/include/nodes/parsenodes.h diff | blob | blame | history
src/include/nodes/pg_list.h diff | blob | blame | history
src/include/parser/parse_agg.h diff | blob | blame | history
src/test/regress/expected/groupingsets.out diff | blob | blame | history
src/test/regress/sql/groupingsets.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /