On Wed, Aug 7, 2024 at 1:06 PM Dirschel, Steve <steve.dirschel@xxxxxxxxxxxxxxxxxx> wrote:
I’ve found multiple postings out there saying you can query pg_stat_all_indexes and look at idx_scan to know if an index has been used by queries. I want to be 100% sure I can rely on that table/column to know if an index has never been used.
Also make sure you check pg_stat_all_indexes on your replicas as well. Each has their own independent idx_scan counters. So while your primary is not using a particular index, one or more of your replicas might be.
Cheers,
Greg