aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/spgist_private.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-03-10 18:36:49 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2012-03-10 18:36:49 -0500
commit03e56f798e365763486b03a2630fbc3190ccd29a (patch)
tree6fbcad7968eaad22de3a7dac6c45f2b8a82de099 /src/include/access/spgist_private.h
parent39d74e346c083aa371ba64c4edb1332c40b56530 (diff)
downloadpostgresql-03e56f798e365763486b03a2630fbc3190ccd29a.tar.gz
postgresql-03e56f798e365763486b03a2630fbc3190ccd29a.zip
Restructure SPGiST opclass interface API to support whole-index scans.
The original API definition was incapable of supporting whole-index scans because there was no way to invoke leaf-value reconstruction without checking any qual conditions. Also, it was inefficient for multiple-qual-condition scans because value reconstruction got done over again for each qual condition, and because other internal work in the consistent functions likewise had to be done for each qual. To fix these issues, pass the whole scankey array to the opclass consistent functions, instead of only letting them see one item at a time. (Essentially, the loop over scankey entries is now inside the consistent functions not outside them. This makes the consistent functions a bit more complicated, but not unreasonably so.) In itself this commit does nothing except save a few cycles in multiple-qual-condition index scans, since we can't support whole-index scans on SPGiST indexes until nulls are included in the index. However, I consider this a must-fix for 9.2 because once we release it will get very much harder to change the opclass API definition.
Diffstat (limited to 'src/include/access/spgist_private.h')
-rw-r--r--src/include/access/spgist_private.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/include/access/spgist_private.h b/src/include/access/spgist_private.h
index fa23acf6cde..76ea5a1578f 100644
--- a/src/include/access/spgist_private.h
+++ b/src/include/access/spgist_private.h
@@ -126,7 +126,11 @@ typedef struct SpGistScanOpaqueData
SpGistState state; /* see above */
MemoryContext tempCxt; /* short-lived memory context */
- /* Index quals for scan (copied from IndexScanDesc for convenience) */
+ /* Control flags showing whether to search nulls and/or non-nulls */
+ bool searchNulls; /* scan matches (all) null entries */
+ bool searchNonNulls; /* scan matches (some) non-null entries */
+
+ /* Index quals to be passed to opclass (null-related quals removed) */
int numberOfKeys; /* number of index qualifier conditions */
ScanKey keyData; /* array of index qualifier descriptors */