Re: Postgres index usage - Mailing list pgsql-performance

From Greg Sabino Mullane
Subject Re: Postgres index usage
Date
Msg-id CAKAnmm+Ei+oeg_X_C=Mkn6amqaYsFVqOzNadKT5ZGiugyibmCg@mail.gmail.com
Whole thread Raw
In response to Postgres index usage  ("Dirschel, Steve" <steve.dirschel@thomsonreuters.com>)
List pgsql-performance
On Wed, Aug 7, 2024 at 1:06 PM Dirschel, Steve <steve.dirschel@thomsonreuters.com> 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

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Postgres index usage
Next
From: Marcelo Zabani
Date:
Subject: Partition pruning with array-contains check and current_setting function