diff options
| author | Tom Lane | 2007-05-27 03:50:39 +0000 |
|---|---|---|
| committer | Tom Lane | 2007-05-27 03:50:39 +0000 |
| commit | 77947c51c08179b8bc12347a7fbcb2c8d7908302 (patch) | |
| tree | 0a306ea177817fdadc0e4421b6d8dd212c11e6e3 /src/backend/access/index/indexam.c | |
| parent | cadb78330eedceafeda99bf12ac690cda773be62 (diff) | |
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.
Diffstat (limited to 'src/backend/access/index/indexam.c')
| -rw-r--r-- | src/backend/access/index/indexam.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c index 23522ba740e..d905013a5fc 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.97 2007/01/05 22:19:23 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.98 2007/05/27 03:50:38 tgl Exp $ * * INTERFACE ROUTINES * index_open - open an index relation by relation OID @@ -145,8 +145,6 @@ index_open(Oid relationId, LOCKMODE lockmode) errmsg("\"%s\" is not an index", RelationGetRelationName(r)))); - pgstat_initstats(&r->pgstat_info, r); - return r; } @@ -433,14 +431,14 @@ index_getnext(IndexScanDesc scan, ScanDirection direction) return NULL; /* failure exit */ } - pgstat_count_index_tuples(&scan->xs_pgstat_info, 1); + pgstat_count_index_tuples(scan->indexRelation, 1); /* * Fetch the heap tuple and see if it matches the snapshot. */ if (heap_release_fetch(scan->heapRelation, scan->xs_snapshot, heapTuple, &scan->xs_cbuf, true, - &scan->xs_pgstat_info)) + scan->indexRelation)) break; /* Skip if no undeleted tuple at this location */ @@ -502,7 +500,7 @@ index_getnext_indexitem(IndexScanDesc scan, Int32GetDatum(direction))); if (found) - pgstat_count_index_tuples(&scan->xs_pgstat_info, 1); + pgstat_count_index_tuples(scan->indexRelation, 1); return found; } @@ -543,7 +541,7 @@ index_getmulti(IndexScanDesc scan, Int32GetDatum(max_tids), PointerGetDatum(returned_tids))); - pgstat_count_index_tuples(&scan->xs_pgstat_info, *returned_tids); + pgstat_count_index_tuples(scan->indexRelation, *returned_tids); return found; } |
