aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-12-19 14:58:41 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-12-19 14:58:41 -0500
commit92203624934095163f8b57b5b3d7bbd2645da2c8 (patch)
tree8570ad85adefe211f46f295b86aaf05d461f3e8a /doc/src
parent3695a555136a6d179cac8ae48d5f90171d5b30e9 (diff)
downloadpostgresql-92203624934095163f8b57b5b3d7bbd2645da2c8.tar.gz
postgresql-92203624934095163f8b57b5b3d7bbd2645da2c8.zip
Teach SP-GiST to do index-only scans.
Operator classes can specify whether or not they support this; this preserves the flexibility to use lossy representations within an index. In passing, move constant data about a given index into the rd_amcache cache area, instead of doing fresh lookups each time we start an index operation. This is mainly to try to make sure that spgcanreturn() has insignificant cost; I still don't have any proof that it matters for actual index accesses. Also, get rid of useless copying of FmgrInfo pointers; we can perfectly well use the relcache's versions in-place.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/spgist.sgml15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/src/sgml/spgist.sgml b/doc/src/sgml/spgist.sgml
index 70e0e9ff503..dcc3cc2d733 100644
--- a/doc/src/sgml/spgist.sgml
+++ b/doc/src/sgml/spgist.sgml
@@ -145,6 +145,7 @@ typedef struct spgConfigOut
{
Oid prefixType; /* Data type of inner-tuple prefixes */
Oid labelType; /* Data type of inner-tuple node labels */
+ bool canReturnData; /* Opclass can reconstruct original data */
bool longValuesOK; /* Opclass can cope with values &gt; 1 page */
} spgConfigOut;
</programlisting>
@@ -159,6 +160,8 @@ typedef struct spgConfigOut
<structfield>prefixType</> can be set to <literal>VOIDOID</>.
Likewise, for operator classes that do not use node labels,
<structfield>labelType</> can be set to <literal>VOIDOID</>.
+ <structfield>canReturnData</> should be set true if the operator class
+ is capable of reconstructing the originally-supplied index value.
<structfield>longValuesOK</> should be set true only when the
<structfield>attType</> is of variable length and the operator
class is capable of segmenting long values by repeated suffixing
@@ -441,6 +444,7 @@ typedef struct spgInnerConsistentIn
Datum reconstructedValue; /* value reconstructed at parent */
int level; /* current level (counting from zero) */
+ bool returnData; /* original data must be returned? */
/* Data from current inner tuple */
bool allTheSame; /* tuple is marked all-the-same? */
@@ -467,6 +471,9 @@ typedef struct spgInnerConsistentOut
parent level.
<structfield>level</> is the current inner tuple's level, starting at
zero for the root level.
+ <structfield>returnData</> is <literal>true</> if reconstructed data is
+ required for this query; this will only be so if the
+ <function>config</> function asserted <structfield>canReturnData</>.
<structfield>allTheSame</> is true if the current inner tuple is
marked <quote>all-the-same</>; in this case all the nodes have the
same label (if any) and so either all or none of them match the query
@@ -525,12 +532,14 @@ typedef struct spgLeafConsistentIn
Datum reconstructedValue; /* value reconstructed at parent */
int level; /* current level (counting from zero) */
+ bool returnData; /* original data must be returned? */
Datum leafDatum; /* datum in leaf tuple */
} spgLeafConsistentIn;
typedef struct spgLeafConsistentOut
{
+ Datum leafValue; /* reconstructed original data, if any */
bool recheck; /* set true if operator must be rechecked */
} spgLeafConsistentOut;
</programlisting>
@@ -543,6 +552,9 @@ typedef struct spgLeafConsistentOut
parent level.
<structfield>level</> is the current leaf tuple's level, starting at
zero for the root level.
+ <structfield>returnData</> is <literal>true</> if reconstructed data is
+ required for this query; this will only be so if the
+ <function>config</> function asserted <structfield>canReturnData</>.
<structfield>leafDatum</> is the key value stored in the current
leaf tuple.
</para>
@@ -550,6 +562,9 @@ typedef struct spgLeafConsistentOut
<para>
The function must return <literal>true</> if the leaf tuple matches the
query, or <literal>false</> if not. In the <literal>true</> case,
+ if <structfield>returnData</> is <literal>true</> then
+ <structfield>leafValue</> must be set to the value originally supplied
+ to be indexed for this leaf tuple. Also,
<structfield>recheck</> may be set to <literal>true</> if the match
is uncertain and so the operator must be re-applied to the actual heap
tuple to verify the match.