diff options
Diffstat (limited to 'src/backend/access/index/indexam.c')
| -rw-r--r-- | src/backend/access/index/indexam.c | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c index c4739aa1cd..d59f1529db 100644 --- a/src/backend/access/index/indexam.c +++ b/src/backend/access/index/indexam.c @@ -8,20 +8,20 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.104 2008/03/26 21:10:37 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.105 2008/04/10 22:25:25 tgl Exp $ * * INTERFACE ROUTINES * index_open - open an index relation by relation OID * index_close - close an index relation * index_beginscan - start a scan of an index with amgettuple - * index_beginscan_multi - start a scan of an index with amgetmulti + * index_beginscan_bitmap - start a scan of an index with amgetbitmap * index_rescan - restart a scan of an index * index_endscan - end a scan * index_insert - insert an index tuple into a relation * index_markpos - mark a scan position * index_restrpos - restore a scan position * index_getnext - get the next tuple from a scan - * index_getmulti - get multiple tuples from a scan + * index_getbitmap - get all tuples from a scan * index_bulk_delete - bulk deletion of index tuples * index_vacuum_cleanup - post-deletion cleanup of an index * index_getprocid - get a support procedure OID @@ -227,7 +227,6 @@ index_beginscan(Relation heapRelation, * Save additional parameters into the scandesc. Everything else was set * up by RelationGetIndexScan. */ - scan->is_multiscan = false; scan->heapRelation = heapRelation; scan->xs_snapshot = snapshot; @@ -235,15 +234,15 @@ index_beginscan(Relation heapRelation, } /* - * index_beginscan_multi - start a scan of an index with amgetmulti + * index_beginscan_bitmap - start a scan of an index with amgetbitmap * * As above, caller had better be holding some lock on the parent heap * relation, even though it's not explicitly mentioned here. */ IndexScanDesc -index_beginscan_multi(Relation indexRelation, - Snapshot snapshot, - int nkeys, ScanKey key) +index_beginscan_bitmap(Relation indexRelation, + Snapshot snapshot, + int nkeys, ScanKey key) { IndexScanDesc scan; @@ -253,7 +252,6 @@ index_beginscan_multi(Relation indexRelation, * Save additional parameters into the scandesc. Everything else was set * up by RelationGetIndexScan. */ - scan->is_multiscan = true; scan->xs_snapshot = snapshot; return scan; @@ -676,44 +674,39 @@ index_getnext_indexitem(IndexScanDesc scan, } /* ---------------- - * index_getmulti - get multiple tuples from an index scan + * index_getbitmap - get all tuples at once from an index scan * - * Collects the TIDs of multiple heap tuples satisfying the scan keys. + * Adds the TIDs of all heap tuples satisfying the scan keys to a bitmap. * Since there's no interlock between the index scan and the eventual heap * access, this is only safe to use with MVCC-based snapshots: the heap * item slot could have been replaced by a newer tuple by the time we get * to it. * - * A TRUE result indicates more calls should occur; a FALSE result says the - * scan is done. *returned_tids could be zero or nonzero in either case. + * Returns the number of matching tuples found. * ---------------- */ -bool -index_getmulti(IndexScanDesc scan, - ItemPointer tids, int32 max_tids, - int32 *returned_tids) +int64 +index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap) { FmgrInfo *procedure; - bool found; + int64 ntids; SCAN_CHECKS; - GET_SCAN_PROCEDURE(amgetmulti); + GET_SCAN_PROCEDURE(amgetbitmap); /* just make sure this is false... */ scan->kill_prior_tuple = false; /* - * have the am's getmulti proc do all the work. + * have the am's getbitmap proc do all the work. */ - found = DatumGetBool(FunctionCall4(procedure, - PointerGetDatum(scan), - PointerGetDatum(tids), - Int32GetDatum(max_tids), - PointerGetDatum(returned_tids))); + ntids = DatumGetInt64(FunctionCall2(procedure, + PointerGetDatum(scan), + PointerGetDatum(bitmap))); - pgstat_count_index_tuples(scan->indexRelation, *returned_tids); + pgstat_count_index_tuples(scan->indexRelation, ntids); - return found; + return ntids; } /* ---------------- |
