From 03e56f798e365763486b03a2630fbc3190ccd29a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 10 Mar 2012 18:36:49 -0500 Subject: 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. --- src/include/access/spgist.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/include/access/spgist.h') diff --git a/src/include/access/spgist.h b/src/include/access/spgist.h index cd6de2c98da..8d0205e691f 100644 --- a/src/include/access/spgist.h +++ b/src/include/access/spgist.h @@ -128,8 +128,8 @@ typedef struct spgPickSplitOut */ typedef struct spgInnerConsistentIn { - StrategyNumber strategy; /* operator strategy number */ - Datum query; /* operator's RHS value */ + ScanKey scankeys; /* array of operators and comparison values */ + int nkeys; /* length of array */ Datum reconstructedValue; /* value reconstructed at parent */ int level; /* current level (counting from zero) */ @@ -156,8 +156,8 @@ typedef struct spgInnerConsistentOut */ typedef struct spgLeafConsistentIn { - StrategyNumber strategy; /* operator strategy number */ - Datum query; /* operator's RHS value */ + ScanKey scankeys; /* array of operators and comparison values */ + int nkeys; /* length of array */ Datum reconstructedValue; /* value reconstructed at parent */ int level; /* current level (counting from zero) */ -- cgit v1.2.3