aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/gist.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-12-03 20:52:18 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2010-12-03 20:53:29 -0500
commit554506871bd3a73a5d9fa4ee3aa0b0fbf406f8ab (patch)
tree92d303d13214cc8dc37d5891f1df3a66b6f3ab53 /src/include/access/gist.h
parentc0a4d3e0511b4d1f7996451329deaa2acd0e18fa (diff)
downloadpostgresql-554506871bd3a73a5d9fa4ee3aa0b0fbf406f8ab.tar.gz
postgresql-554506871bd3a73a5d9fa4ee3aa0b0fbf406f8ab.zip
KNNGIST, otherwise known as order-by-operator support for GIST.
This commit represents a rather heavily editorialized version of Teodor's builtin_knngist_itself-0.8.2 and builtin_knngist_proc-0.8.1 patches. I redid the opclass API to add a separate Distance method instead of turning the Consistent method into an illogical mess, fixed some bit-rot in the rbtree interfaces, and generally worked over the code style and comments. There's still no non-code documentation to speak of, but I'll work on that separately. Some contrib-module changes are also yet to come (right now, point <-> point is the only KNN-ified operator). Teodor Sigaev and Tom Lane
Diffstat (limited to 'src/include/access/gist.h')
-rw-r--r--src/include/access/gist.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/include/access/gist.h b/src/include/access/gist.h
index 0d9449b9917..01fddb94af9 100644
--- a/src/include/access/gist.h
+++ b/src/include/access/gist.h
@@ -32,7 +32,8 @@
#define GIST_PENALTY_PROC 5
#define GIST_PICKSPLIT_PROC 6
#define GIST_EQUAL_PROC 7
-#define GISTNProcs 7
+#define GIST_DISTANCE_PROC 8
+#define GISTNProcs 8
/*
* strategy numbers for GiST opclasses that want to implement the old
@@ -52,6 +53,7 @@
#define RTOverAboveStrategyNumber 12
#define RTOldContainsStrategyNumber 13 /* for old spelling of @> */
#define RTOldContainedByStrategyNumber 14 /* for old spelling of <@ */
+#define RTKNNSearchStrategyNumber 15
/*
* Page opaque data in a GiST index page.
@@ -131,13 +133,13 @@ typedef struct GISTENTRY
#define GistClearTuplesDeleted(page) ( GistPageGetOpaque(page)->flags &= ~F_TUPLES_DELETED)
/*
- * Vector of GISTENTRY structs; user-defined methods union and pick
- * split takes it as one of their arguments
+ * Vector of GISTENTRY structs; user-defined methods union and picksplit
+ * take it as one of their arguments
*/
typedef struct
{
int32 n; /* number of elements */
- GISTENTRY vector[1];
+ GISTENTRY vector[1]; /* variable-length array */
} GistEntryVector;
#define GEVHDRSZ (offsetof(GistEntryVector, vector))