Re: BUG #17163: spgist index scan statistics stays at 0

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: github@cquest.org
Cc: pgsql-bugs@lists.postgresql.org
Date: 2021-08-27T18:33:04Z
Lists: pgsql-bugs

Attachments

PG Bug reporting form <noreply@postgresql.org> writes:
> The idx_scan in pg_stat_all_indexes stays at 0 for spgist index, while the
> idx_tup_read and idx_tup_fetch and correctly updated.

Hmm, you're right, there's no pgstat_count_index_scan anywhere in
access/spgist/ :-(

The other index AMs do that during the first amgettuple or amgetbitmap
call, but it doesn't look like there is any convenient way to duplicate
that behavior in spgist; none of the code in or below spggettuple or
spggetbitmap is explicitly aware of whether this is the first call.
I'm inclined to propose adding the counter bump in spgrescan.  That
isn't *exactly* equivalent semantics, but it would only matter if
someplace called amrescan and then didn't follow through with a scan.
The attached seems to behave as I'd expect.

			regards, tom lane

Commits

  1. Count SP-GiST index scans in pg_stat statistics.

  2. Create core infrastructure for KNNGIST.