summaryrefslogtreecommitdiff
path: root/src/include/access
diff options
context:
space:
mode:
authorTom Lane2011-12-07 05:18:38 +0000
committerTom Lane2011-12-07 05:19:39 +0000
commitc6e3ac11b60ac4a8942ab964252d51c1c0bd8845 (patch)
treefa9ffffed5b31d01a007f447368fd9479bba3aef /src/include/access
parentd2a662182eac1069ff3874a1db499508a13c6bca (diff)
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
Diffstat (limited to 'src/include/access')
-rw-r--r--src/include/access/nbtree.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index 347d9423ba3..9a751ce1004 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -417,13 +417,18 @@ typedef struct xl_btree_newroot
/*
* When a new operator class is declared, we require that the user
- * supply us with an amproc procedure for determining whether, for
- * two keys a and b, a < b, a = b, or a > b. This routine must
- * return < 0, 0, > 0, respectively, in these three cases. Since we
- * only have one such proc in amproc, it's number 1.
+ * supply us with an amproc procedure (BTORDER_PROC) for determining
+ * whether, for two keys a and b, a < b, a = b, or a > b. This routine
+ * must return < 0, 0, > 0, respectively, in these three cases. (It must
+ * not return INT_MIN, since we may negate the result before using it.)
+ *
+ * To facilitate accelerated sorting, an operator class may choose to
+ * offer a second procedure (BTSORTSUPPORT_PROC). For full details, see
+ * src/include/utils/sortsupport.h.
*/
-#define BTORDER_PROC 1
+#define BTORDER_PROC 1
+#define BTSORTSUPPORT_PROC 2
/*
* We need to be able to tell the difference between read and write