1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

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.
This commit is contained in:
Tom Lane
2008-04-13 19:18:14 +00:00
parent c22ed3d523
commit 24558da14a
11 changed files with 141 additions and 127 deletions

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.11 2008/04/10 22:25:25 tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.12 2008/04/13 19:18:13 tgl Exp $
*-------------------------------------------------------------------------
*/
@ -428,11 +428,14 @@ keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx, GinScanKey
* returns true if found
*/
static bool
scanGetItem(IndexScanDesc scan, ItemPointerData *item)
scanGetItem(IndexScanDesc scan, ItemPointerData *item, bool *recheck)
{
uint32 i;
GinScanOpaque so = (GinScanOpaque) scan->opaque;
/* XXX for the moment, treat all GIN operators as lossy */
*recheck = true;
ItemPointerSetMin(item);
for (i = 0; i < so->nkeys; i++)
{
@ -496,13 +499,14 @@ gingetbitmap(PG_FUNCTION_ARGS)
for (;;)
{
ItemPointerData iptr;
bool recheck;
CHECK_FOR_INTERRUPTS();
if (!scanGetItem(scan, &iptr))
if (!scanGetItem(scan, &iptr, &recheck))
break;
tbm_add_tuples(tbm, &iptr, 1, false);
tbm_add_tuples(tbm, &iptr, 1, recheck);
ntids++;
}
@ -528,7 +532,7 @@ gingettuple(PG_FUNCTION_ARGS)
PG_RETURN_BOOL(false);
startScan(scan);
res = scanGetItem(scan, &scan->xs_ctup.t_self);
res = scanGetItem(scan, &scan->xs_ctup.t_self, &scan->xs_recheck);
stopScan(scan);
PG_RETURN_BOOL(res);