From bf3dbb5881e9b886ee9fe84bca2153c698eea885 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 27 Mar 2005 23:53:05 +0000 Subject: First steps towards index scans with heap access decoupled from index access: define new index access method functions 'amgetmulti' that can fetch multiple TIDs per call. (The functions exist but are totally untested as yet.) Since I was modifying pg_am anyway, remove the no-longer-needed 'rel' parameter from amcostestimate functions, and also remove the vestigial amowner column that was creating useless work for Alvaro's shared-object-dependencies project. Initdb forced due to changes in pg_am. --- src/backend/access/gist/gistget.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/backend/access/gist/gistget.c') diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index 03856874f3..8f7a6c7ed4 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.44 2005/02/05 19:38:58 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.45 2005/03/27 23:52:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -47,6 +47,33 @@ gistgettuple(PG_FUNCTION_ARGS) PG_RETURN_BOOL(res); } +Datum +gistgetmulti(PG_FUNCTION_ARGS) +{ + IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0); + ItemPointer tids = (ItemPointer) PG_GETARG_POINTER(1); + int32 max_tids = PG_GETARG_INT32(2); + int32 *returned_tids = (int32 *) PG_GETARG_POINTER(3); + bool res = true; + int32 ntids = 0; + + /* XXX generic implementation: loop around guts of gistgettuple */ + while (ntids < max_tids) + { + if (ItemPointerIsValid(&(s->currentItemData))) + res = gistnext(s, ForwardScanDirection); + else + res = gistfirst(s, ForwardScanDirection); + if (!res) + break; + tids[ntids] = s->xs_ctup.t_self; + ntids++; + } + + *returned_tids = ntids; + PG_RETURN_BOOL(res); +} + static bool gistfirst(IndexScanDesc s, ScanDirection dir) { -- cgit v1.2.1