Index statistics
There are a parallel set of statistics to the table ones that break down activity for each individual index. pg_stat_user_indexes
also has system/all versions available, and it gives information about how many index scans were done and the rows returned by them.
The naming of the fields in this view are more complicated to distinguish among though. Two fields that look similar are subtly different:
idx_tup_read
: "number of index entries returned by index scans".idx_tup_fetch
: "number of live table rows fetched by simple index scans using that index". This number will often be a bit smaller than theidx_tup_read
value because it won't include dead or not yet committed rows in its count. In addition, the use of "simple" here means that the index access was not a bitmap index scan. When those execute, there are at least two indexes involved. That makes it impossible to properly account for what index was responsible for a particular...