From 77947c51c08179b8bc12347a7fbcb2c8d7908302 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 27 May 2007 03:50:39 +0000 Subject: Fix up pgstats counting of live and dead tuples to recognize that committed and aborted transactions have different effects; also teach it not to assume that prepared transactions are always committed. Along the way, simplify the pgstats API by tying counting directly to Relations; I cannot detect any redeeming social value in having stats pointers in HeapScanDesc and IndexScanDesc structures. And fix a few corner cases in which counts might be missed because the relation's pgstat_info pointer hadn't been set. --- src/backend/executor/nodeBitmapHeapscan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/backend/executor/nodeBitmapHeapscan.c') diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index 3e9a91de2f5..07729da2be6 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.16 2007/01/05 22:19:28 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.17 2007/05/27 03:50:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -189,7 +189,7 @@ BitmapHeapNext(BitmapHeapScanState *node) scan->rs_ctup.t_len = ItemIdGetLength(lp); ItemPointerSet(&scan->rs_ctup.t_self, tbmres->blockno, targoffset); - pgstat_count_heap_fetch(&scan->rs_pgstat_info); + pgstat_count_heap_fetch(scan->rs_rd); /* * Set up the result slot to point to this tuple. Note that the slot @@ -389,7 +389,7 @@ ExecBitmapHeapReScan(BitmapHeapScanState *node, ExprContext *exprCtxt) 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_pgstat_info); + pgstat_discount_heap_scan(node->ss.ss_currentScanDesc->rs_rd); if (node->tbm) tbm_free(node->tbm); @@ -535,7 +535,7 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags) * when we actually aren't doing any such thing. Reverse out the added * scan count. (Eventually we may want to count bitmap scans separately.) */ - pgstat_discount_heap_scan(&scanstate->ss.ss_currentScanDesc->rs_pgstat_info); + pgstat_discount_heap_scan(scanstate->ss.ss_currentScanDesc->rs_rd); /* * get the scan type from the relation descriptor. -- cgit v1.2.3