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

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 4abd7b4) | patch
Improve SELECT DISTINCT to consider hash aggregation, as well as sort/uniq,
Tue, 5 Aug 2008 02:43:18 +0000 (02:43 +0000)
Tue, 5 Aug 2008 02:43:18 +0000 (02:43 +0000)
commit be3b265c94443b75262e89149f148ace0fdf75da
Improve SELECT DISTINCT to consider hash aggregation, as well as sort/uniq,
as methods for implementing the DISTINCT step. This eliminates the former
performance gap between DISTINCT and GROUP BY, and also makes it possible
to do SELECT DISTINCT on datatypes that only support hashing not sorting.

SELECT DISTINCT ON is still always implemented by sorting; it would take
executor changes to support hashing that, and it's not clear it's worth
the trouble.

This is a release-note-worthy incompatibility from previous PG versions,
since SELECT DISTINCT can no longer be counted on to deliver sorted output
without explicitly saying ORDER BY. (Anyone who can't cope with that
can consider turning off enable_hashagg.)

Several regression test queries needed to have ORDER BY added to preserve
stable output order. I fixed the ones that manifested here, but there
might be some other cases that show up on other platforms.
13 files changed:
src/backend/nodes/outfuncs.c diff | blob | blame | history
src/backend/optimizer/plan/planmain.c diff | blob | blame | history
src/backend/optimizer/plan/planner.c diff | blob | blame | history
src/backend/parser/parse_clause.c diff | blob | blame | history
src/include/nodes/relation.h diff | blob | blame | history
src/test/regress/expected/numerology.out diff | blob | blame | history
src/test/regress/expected/opr_sanity.out diff | blob | blame | history
src/test/regress/expected/select_distinct.out diff | blob | blame | history
src/test/regress/input/misc.source diff | blob | blame | history
src/test/regress/output/misc.source diff | blob | blame | history
src/test/regress/sql/numerology.sql diff | blob | blame | history
src/test/regress/sql/opr_sanity.sql diff | blob | blame | history
src/test/regress/sql/select_distinct.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

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