diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-04-13 19:18:14 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-04-13 19:18:14 +0000 |
commit | 24558da14a26337e945732d3b435b07edcbb6733 (patch) | |
tree | 7a6fbd12b1793e46d4584f49a1bc9373300125d8 /doc/src | |
parent | c22ed3d523782c43836c163c16fa5a7bb3912826 (diff) | |
download | postgresql-24558da14a26337e945732d3b435b07edcbb6733.tar.gz postgresql-24558da14a26337e945732d3b435b07edcbb6733.zip |
Phase 2 of project to make index operator lossiness be determined at runtime
instead of plan time. Extend the amgettuple API so that the index AM returns
a boolean indicating whether the indexquals need to be rechecked, and make
that rechecking happen in nodeIndexscan.c (currently the only place where
it's expected to be needed; other callers of index_getnext are just erroring
out for now). For the moment, GIN and GIST have stub logic that just always
sets the recheck flag to TRUE --- I'm hoping to get Teodor to handle pushing
that control down to the opclass consistent() functions. The planner no
longer pays any attention to amopreqcheck, and that catalog column will go
away in due course.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/indexam.sgml | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml index 65da721de47..1b42ff0231a 100644 --- a/doc/src/sgml/indexam.sgml +++ b/doc/src/sgml/indexam.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/indexam.sgml,v 2.24 2008/04/10 22:25:25 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/indexam.sgml,v 2.25 2008/04/13 19:18:13 tgl Exp $ --> <chapter id="indexam"> <title>Index Access Method Interface Definition</title> @@ -315,7 +315,15 @@ amgettuple (IndexScanDesc scan, TID is stored into the <literal>scan</> structure. Note that <quote>success</> means only that the index contains an entry that matches the scan keys, not that the tuple necessarily still exists in the heap or - will pass the caller's snapshot test. + will pass the caller's snapshot test. On success, <function>amgettuple</> + must also set <literal>scan->xs_recheck</> to TRUE or FALSE. + FALSE means it is certain that the index entry matches the scan keys. + TRUE means this is not certain, and the conditions represented by the + scan keys must be rechecked against the heap tuple after fetching it. + This provision supports <quote>lossy</> index operators. + Note that rechecking will extend only to the scan conditions; a partial + index predicate (if any) is never rechecked by <function>amgettuple</> + callers. </para> <para> @@ -327,6 +335,14 @@ amgetbitmap (IndexScanDesc scan, Fetch all tuples in the given scan and add them to the caller-supplied TIDBitmap (that is, OR the set of tuple IDs into whatever set is already in the bitmap). The number of tuples fetched is returned. + While inserting tuple IDs into the bitmap, <function>amgetbitmap</> can + indicate that rechecking of the scan conditions is required for specific + tuple IDs. This is analogous to the <literal>xs_recheck</> output parameter + of <function>amgettuple</>. Note: in the current implementation, support + for this feature is conflated with support for lossy storage of the bitmap + itself, and therefore callers recheck both the scan conditions and the + partial index predicate (if any) for recheckable tuples. That might not + always be true, however. <function>amgetbitmap</> and <function>amgettuple</> cannot be used in the same index scan; there are other restrictions too when using <function>amgetbitmap</>, as explained |