Count SP-GiST index scans in pg_stat statistics.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 27 Aug 2021 23:42:42 +0000 (19:42 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 27 Aug 2021 23:53:05 +0000 (19:53 -0400)
commit3778bcb39a94a3b6a821fd60fcd9919a95725e78
treeeb755e597d017d4935ed50116b820c62ff0eaa12
parentce42efaa2696fa74dffcbaa7d25c4ef00e93e1c0
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: http://postgr.es/m/17163-b8c5cc88322a5e92@postgresql.org
src/backend/access/spgist/spgscan.c