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

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 1605291) | patch
Use abbreviated keys for faster sorting of text datums.
2015年1月19日 20:20:31 +0000 (15:20 -0500)
2015年1月19日 20:28:27 +0000 (15:28 -0500)
commit 4ea51cdfe85ceef8afabceb03c446574daa0ac23
Use abbreviated keys for faster sorting of text datums.

This commit extends the SortSupport infrastructure to allow operator
classes the option to provide abbreviated representations of Datums;
in the case of text, we abbreviate by taking the first few characters
of the strxfrm() blob. If the abbreviated comparison is insufficent
to resolve the comparison, we fall back on the normal comparator.
This can be much faster than the old way of doing sorting if the
first few bytes of the string are usually sufficient to resolve the
comparison.

There is the potential for a performance regression if all of the
strings to be sorted are identical for the first 8+ characters and
differ only in later positions; therefore, the SortSupport machinery
now provides an infrastructure to abort the use of abbreviation if
it appears that abbreviation is producing comparatively few distinct
keys. HyperLogLog, a streaming cardinality estimator, is included in
this commit and used to make that determination for text.

Peter Geoghegan, reviewed by me.
13 files changed:
src/backend/access/nbtree/nbtsort.c diff | blob | blame | history
src/backend/commands/analyze.c diff | blob | blame | history
src/backend/executor/nodeAgg.c diff | blob | blame | history
src/backend/executor/nodeMergeAppend.c diff | blob | blame | history
src/backend/executor/nodeMergejoin.c diff | blob | blame | history
src/backend/lib/Makefile diff | blob | blame | history
src/backend/lib/hyperloglog.c [new file with mode: 0644] blob
src/backend/utils/adt/orderedsetaggs.c diff | blob | blame | history
src/backend/utils/adt/varlena.c diff | blob | blame | history
src/backend/utils/sort/tuplesort.c diff | blob | blame | history
src/include/lib/hyperloglog.h [new file with mode: 0644] blob
src/include/pg_config_manual.h diff | blob | blame | history
src/include/utils/sortsupport.h diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

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