aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/gist/gistget.c6
-rw-r--r--src/backend/access/hash/hashsearch.c5
-rw-r--r--src/backend/access/heap/heapam.c29
-rw-r--r--src/backend/access/index/indexam.c17
-rw-r--r--src/backend/access/nbtree/nbtsearch.c5
-rw-r--r--src/backend/access/rtree/rtget.c5
6 files changed, 37 insertions, 30 deletions
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index f63bc477ae7..5ae48bd66e3 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.51 2005/09/22 20:44:36 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.52 2005/10/06 02:29:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,8 +17,10 @@
#include "access/itup.h"
#include "access/gist_private.h"
#include "executor/execdebug.h"
+#include "pgstat.h"
#include "utils/memutils.h"
+
static OffsetNumber gistfindnext(IndexScanDesc scan, OffsetNumber n,
ScanDirection dir);
static int gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, bool ignore_killed_tuples);
@@ -161,6 +163,8 @@ gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, b
stk->next = NULL;
stk->block = GIST_ROOT_BLKNO;
+
+ pgstat_count_index_scan(&scan->xs_pgstat_info);
}
else if (so->curbuf == InvalidBuffer)
{
diff --git a/src/backend/access/hash/hashsearch.c b/src/backend/access/hash/hashsearch.c
index 3bef1694125..9aaf70b0a9e 100644
--- a/src/backend/access/hash/hashsearch.c
+++ b/src/backend/access/hash/hashsearch.c
@@ -8,13 +8,14 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashsearch.c,v 1.38 2004/12/31 21:59:13 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashsearch.c,v 1.39 2005/10/06 02:29:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "access/hash.h"
+#include "pgstat.h"
#include "storage/lmgr.h"
@@ -130,6 +131,8 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
ItemPointer current;
OffsetNumber offnum;
+ pgstat_count_index_scan(&scan->xs_pgstat_info);
+
current = &(scan->currentItemData);
ItemPointerSetInvalid(current);
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 46c7c4da73f..185918d03aa 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.198 2005/08/20 00:39:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.199 2005/10/06 02:29:10 tgl Exp $
*
*
* INTERFACE ROUTINES
@@ -47,10 +47,10 @@
#include "catalog/catalog.h"
#include "catalog/namespace.h"
#include "miscadmin.h"
+#include "pgstat.h"
#include "storage/procarray.h"
#include "utils/inval.h"
#include "utils/relcache.h"
-#include "pgstat.h"
static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf,
@@ -90,6 +90,8 @@ initscan(HeapScanDesc scan, ScanKey key)
*/
if (key != NULL)
memcpy(scan->rs_key, key, scan->rs_nkeys * sizeof(ScanKeyData));
+
+ pgstat_count_heap_scan(&scan->rs_pgstat_info);
}
/* ----------------
@@ -680,8 +682,6 @@ heap_rescan(HeapScanDesc scan,
* reinitialize scan descriptor
*/
initscan(scan, key);
-
- pgstat_reset_heap_scan(&scan->rs_pgstat_info);
}
/* ----------------
@@ -762,8 +762,6 @@ heap_getnext(HeapScanDesc scan, ScanDirection direction)
return NULL;
}
- pgstat_count_heap_scan(&scan->rs_pgstat_info);
-
/*
* if we get here it means we have a new current scan tuple, so point
* to the proper return buffer and return the tuple.
@@ -927,14 +925,9 @@ heap_release_fetch(Relation relation,
*/
*userbuf = buffer;
- /*
- * Count the successful fetch in *pgstat_info if given, otherwise
- * in the relation's default statistics area.
- */
+ /* Count the successful fetch in *pgstat_info, if given. */
if (pgstat_info != NULL)
pgstat_count_heap_fetch(pgstat_info);
- else
- pgstat_count_heap_fetch(&relation->pgstat_info);
return true;
}
@@ -1152,8 +1145,6 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
RelationPutHeapTuple(relation, buffer, tup);
- pgstat_count_heap_insert(&relation->pgstat_info);
-
/* XLOG stuff */
if (relation->rd_istemp)
{
@@ -1229,6 +1220,8 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
*/
CacheInvalidateHeapTuple(relation, tup);
+ pgstat_count_heap_insert(&relation->pgstat_info);
+
return HeapTupleGetOid(tup);
}
@@ -1481,8 +1474,6 @@ l1:
if (HeapTupleHasExternal(&tp))
heap_tuple_toast_attrs(relation, NULL, &tp);
- pgstat_count_heap_delete(&relation->pgstat_info);
-
/*
* Mark tuple for invalidation from system caches at next command
* boundary. We have to do this before WriteBuffer because we need to
@@ -1499,6 +1490,8 @@ l1:
if (have_tuple_lock)
UnlockTuple(relation, &(tp.t_self), ExclusiveLock);
+ pgstat_count_heap_delete(&relation->pgstat_info);
+
return HeapTupleMayBeUpdated;
}
@@ -1851,8 +1844,6 @@ l2:
newbuf = buffer;
}
- pgstat_count_heap_update(&relation->pgstat_info);
-
/*
* At this point newbuf and buffer are both pinned and locked, and
* newbuf has enough space for the new tuple. If they are the same
@@ -1929,6 +1920,8 @@ l2:
if (have_tuple_lock)
UnlockTuple(relation, &(oldtup.t_self), ExclusiveLock);
+ pgstat_count_heap_update(&relation->pgstat_info);
+
return HeapTupleMayBeUpdated;
}
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c
index 624b53d635c..7bf7fcd22f0 100644
--- a/src/backend/access/index/indexam.c
+++ b/src/backend/access/index/indexam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.84 2005/06/27 12:45:22 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.85 2005/10/06 02:29:11 tgl Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relation OID
@@ -65,9 +65,9 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "pgstat.h"
#include "utils/relcache.h"
-#include "pgstat.h"
/* ----------------------------------------------------------------
* macros used in index_ routines
@@ -354,8 +354,6 @@ index_rescan(IndexScanDesc scan, ScanKey key)
FunctionCall2(procedure,
PointerGetDatum(scan),
PointerGetDatum(key));
-
- pgstat_reset_index_scan(&scan->xs_pgstat_info);
}
/* ----------------
@@ -521,8 +519,6 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
{
bool found;
- pgstat_count_index_scan(&scan->xs_pgstat_info);
-
/*
* The AM's gettuple proc finds the next tuple matching the scan
* keys.
@@ -545,6 +541,8 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
return NULL; /* failure exit */
}
+ pgstat_count_index_tuples(&scan->xs_pgstat_info, 1);
+
/*
* Fetch the heap tuple and see if it matches the snapshot.
*/
@@ -583,8 +581,6 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
* initialized to 0, which is the correct state ("on row").
*/
- pgstat_count_index_getnext(&scan->xs_pgstat_info);
-
return heapTuple;
}
@@ -621,6 +617,9 @@ index_getnext_indexitem(IndexScanDesc scan,
PointerGetDatum(scan),
Int32GetDatum(direction)));
+ if (found)
+ pgstat_count_index_tuples(&scan->xs_pgstat_info, 1);
+
return found;
}
@@ -660,6 +659,8 @@ index_getmulti(IndexScanDesc scan,
Int32GetDatum(max_tids),
PointerGetDatum(returned_tids)));
+ pgstat_count_index_tuples(&scan->xs_pgstat_info, *returned_tids);
+
return found;
}
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index 42bd6574aaf..c029824fa6f 100644
--- a/src/backend/access/nbtree/nbtsearch.c
+++ b/src/backend/access/nbtree/nbtsearch.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.93 2005/06/19 22:41:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.94 2005/10/06 02:29:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,6 +17,7 @@
#include "access/genam.h"
#include "access/nbtree.h"
+#include "pgstat.h"
#include "utils/lsyscache.h"
@@ -501,6 +502,8 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
int i;
StrategyNumber strat_total;
+ pgstat_count_index_scan(&scan->xs_pgstat_info);
+
/*
* Examine the scan keys and eliminate any redundant keys; also
* discover how many keys must be matched to continue the scan.
diff --git a/src/backend/access/rtree/rtget.c b/src/backend/access/rtree/rtget.c
index e076d5a989c..199a178c4fd 100644
--- a/src/backend/access/rtree/rtget.c
+++ b/src/backend/access/rtree/rtget.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/rtree/rtget.c,v 1.35 2005/03/27 23:53:02 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/rtree/rtget.c,v 1.36 2005/10/06 02:29:14 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,6 +18,8 @@
#include "access/iqual.h"
#include "access/relscan.h"
#include "access/rtree.h"
+#include "pgstat.h"
+
static OffsetNumber findnext(IndexScanDesc s, OffsetNumber n,
ScanDirection dir);
@@ -118,6 +120,7 @@ rtnext(IndexScanDesc s, ScanDirection dir)
/* first call: start at the root */
Assert(BufferIsValid(so->curbuf) == false);
so->curbuf = ReadBuffer(s->indexRelation, P_ROOT);
+ pgstat_count_index_scan(&s->xs_pgstat_info);
}
p = BufferGetPage(so->curbuf);