Create a "sort support" interface API for faster sorting.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: c6e3ac11b60ac4a8942ab964252d51c1c0bd8845
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2011-12-07T05:19:39Z
Releases: 9.2.0
Create a "sort support" interface API for faster sorting.

This patch creates an API whereby a btree index opclass can optionally
provide non-SQL-callable support functions for sorting.  In the initial
patch, we only use this to provide a directly-callable comparator function,
which can be invoked with a bit less overhead than the traditional
SQL-callable comparator.  While that should be of value in itself, the real
reason for doing this is to provide a datatype-extensible framework for
more aggressive optimizations, as in Peter Geoghegan's recent work.

Robert Haas and Tom Lane

Files

PathChange+/−
doc/src/sgml/ref/alter_opfamily.sgml modified +5 −4
doc/src/sgml/ref/create_opclass.sgml modified +8 −7
doc/src/sgml/xindex.sgml modified +23 −11
src/backend/access/nbtree/nbtcompare.c modified +106 −0
src/backend/commands/analyze.c modified +13 −15
src/backend/commands/opclasscmds.c modified +54 −34
src/backend/executor/nodeMergeAppend.c modified +16 −61
src/backend/executor/nodeMergejoin.c modified +56 −90
src/backend/utils/adt/date.c modified +23 −0
src/backend/utils/adt/float.c modified +37 −0
src/backend/utils/adt/timestamp.c modified +19 −0
src/backend/utils/cache/lsyscache.c modified +28 −15
src/backend/utils/sort/Makefile modified +1 −1
src/backend/utils/sort/sortsupport.c added +160 −0
src/backend/utils/sort/tuplesort.c modified +40 −103
src/bin/pg_dump/pg_dump.c modified +26 −4
src/include/access/nbtree.h modified +10 −5
src/include/catalog/catversion.h modified +1 −1
src/include/catalog/pg_am.h modified +1 −1
src/include/catalog/pg_amproc.h modified +10 −0
src/include/catalog/pg_proc.h modified +18 −0
src/include/nodes/execnodes.h modified +3 −2
src/include/utils/builtins.h modified +14 −1
src/include/utils/date.h modified +1 −0
src/include/utils/lsyscache.h modified +2 −2
src/include/utils/sortsupport.h added +156 −0
src/include/utils/timestamp.h modified +1 −0
src/include/utils/tuplesort.h modified +0 −15
src/test/regress/expected/opr_sanity.out modified +19 −26
src/test/regress/sql/opr_sanity.sql modified +19 −24