diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-10-06 02:29:23 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-10-06 02:29:23 +0000 |
commit | cb8b6618cefa1f87197390ae12709b46f5137a35 (patch) | |
tree | 6180b2eed06fe60c41ef34e88e672743b0fdb046 /src/backend/executor/nodeBitmapHeapscan.c | |
parent | b5aad11a1b253bbd45405dc926f1ebef90f8f28c (diff) | |
download | postgresql-cb8b6618cefa1f87197390ae12709b46f5137a35.tar.gz postgresql-cb8b6618cefa1f87197390ae12709b46f5137a35.zip |
Revise pgstats stuff to fix the problems with not counting accesses
generated by bitmap index scans. Along the way, simplify and speed up
the code for counting sequential and index scans; it was both confusing
and inefficient to be taking care of that in the per-tuple loops, IMHO.
initdb forced because of internal changes in pg_stat view definitions.
Diffstat (limited to 'src/backend/executor/nodeBitmapHeapscan.c')
-rw-r--r-- | src/backend/executor/nodeBitmapHeapscan.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index 16d9bf0611c..3c3c1fd96f1 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.2 2005/05/06 17:24:54 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.3 2005/10/06 02:29:16 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -39,6 +39,7 @@ #include "executor/execdebug.h" #include "executor/nodeBitmapHeapscan.h" #include "parser/parsetree.h" +#include "pgstat.h" #include "utils/memutils.h" @@ -328,6 +329,9 @@ 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_pgstat_info); + if (node->tbm) tbm_free(node->tbm); node->tbm = NULL; @@ -476,6 +480,13 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate) 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.) + */ + pgstat_discount_heap_scan(&scanstate->ss.ss_currentScanDesc->rs_pgstat_info); + + /* * get the scan type from the relation descriptor. */ ExecAssignScanType(&scanstate->ss, RelationGetDescr(currentRelation), false); |