diff options
author | Tom Lane | 2021-08-27 23:42:42 +0000 |
---|---|---|
committer | Tom Lane | 2021-08-27 23:53:05 +0000 |
commit | 3778bcb39a94a3b6a821fd60fcd9919a95725e78 (patch) | |
tree | eb755e597d017d4935ed50116b820c62ff0eaa12 | |
parent | ce42efaa2696fa74dffcbaa7d25c4ef00e93e1c0 (diff) |
Count SP-GiST index scans in pg_stat statistics.
Somehow, spgist overlooked the need to call pgstat_count_index_scan().
Hence, pg_stat_all_indexes.idx_scan and equivalent columns never
became nonzero for an SP-GiST index, although the related per-tuple
counters worked fine.
This fix works a bit differently from other index AMs, in that the
counter increment occurs in spgrescan not spggettuple/spggetbitmap.
It looks like this won't make the user-visible semantics noticeably
different, so I won't go to the trouble of introducing an is-this-
the-first-call flag just to make the counter bumps happen in the
same places.
Per bug #17163 from Christian Quest. Back-patch to all supported
versions.
Discussion: https://postgr.es/m/[email protected]
-rw-r--r-- | src/backend/access/spgist/spgscan.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/access/spgist/spgscan.c b/src/backend/access/spgist/spgscan.c index e14b9fa573..401a1a8343 100644 --- a/src/backend/access/spgist/spgscan.c +++ b/src/backend/access/spgist/spgscan.c @@ -19,6 +19,7 @@ #include "access/relscan.h" #include "access/spgist_private.h" #include "miscadmin.h" +#include "pgstat.h" #include "storage/bufmgr.h" #include "utils/datum.h" #include "utils/float.h" @@ -419,6 +420,9 @@ spgrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, /* set up starting queue entries */ resetSpGistScanOpaque(so); + + /* count an indexscan for stats */ + pgstat_count_index_scan(scan->indexRelation); } void |