From 85d72f05167b87bc44464b2eabea8538f1fd1e45 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 9 Jun 2007 18:49:55 +0000 Subject: Teach heapam code to know the difference between a real seqscan and the pseudo HeapScanDesc created for a bitmap heap scan. This avoids some useless overhead during a bitmap scan startup, in particular invoking the syncscan code. (We might someday want to do that, but right now it's merely useless contention for shared memory, to say nothing of possibly pushing useful entries out of syncscan's small LRU list.) This also allows elimination of ugly pgstat_discount_heap_scan() kluge. --- src/backend/executor/nodeBitmapHeapscan.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'src/backend/executor/nodeBitmapHeapscan.c') diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index 07729da2be6..c2ae755e014 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -21,7 +21,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.17 2007/05/27 03:50:39 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.18 2007/06/09 18:49:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -388,9 +388,6 @@ ExecBitmapHeapReScan(BitmapHeapScanState *node, ExprContext *exprCtxt) /* rescan to release any page pin */ heap_rescan(node->ss.ss_currentScanDesc, NULL); - /* undo bogus "seq scan" count (see notes in ExecInitBitmapHeapScan) */ - pgstat_discount_heap_scan(node->ss.ss_currentScanDesc->rs_rd); - if (node->tbm) tbm_free(node->tbm); node->tbm = NULL; @@ -522,20 +519,12 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags) /* * Even though we aren't going to do a conventional seqscan, it is useful - * to create a HeapScanDesc --- this checks the relation size and sets up - * statistical infrastructure for us. - */ - scanstate->ss.ss_currentScanDesc = heap_beginscan(currentRelation, - estate->es_snapshot, - 0, - NULL); - - /* - * One problem is that heap_beginscan counts a "sequential scan" start, - * when we actually aren't doing any such thing. Reverse out the added - * scan count. (Eventually we may want to count bitmap scans separately.) + * to create a HeapScanDesc --- most of the fields in it are usable. */ - pgstat_discount_heap_scan(scanstate->ss.ss_currentScanDesc->rs_rd); + scanstate->ss.ss_currentScanDesc = heap_beginscan_bm(currentRelation, + estate->es_snapshot, + 0, + NULL); /* * get the scan type from the relation descriptor. -- cgit v1.2.3