diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-27 23:53:05 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-27 23:53:05 +0000 |
commit | bf3dbb5881e9b886ee9fe84bca2153c698eea885 (patch) | |
tree | eaaf385364adebc2489c72f30e533f5fe60748ec /src/backend/access/gist/gistget.c | |
parent | 351519affcffb636de68c4872521c9ac22faa228 (diff) | |
download | postgresql-bf3dbb5881e9b886ee9fe84bca2153c698eea885.tar.gz |
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.
Diffstat (limited to 'src/backend/access/gist/gistget.c')
-rw-r--r-- | src/backend/access/gist/gistget.c | 29 |
1 files changed, 28 insertions, 1 deletions
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) { |