Re: Postgres index usage

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: "Dirschel, Steve" <steve(dot)dirschel(at)thomsonreuters(dot)com>
Cc: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Postgres index usage
Date: 2024-08-07 18:18:46
Message-ID: CAKAnmm+Ei+oeg_X_C=Mkn6amqaYsFVqOzNadKT5ZGiugyibmCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Aug 7, 2024 at 1:06 PM Dirschel, Steve <
steve(dot)dirschel(at)thomsonreuters(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Marcelo Zabani 2024-08-07 21:10:04 Partition pruning with array-contains check and current_setting function
Previous Message Tom Lane 2024-08-07 17:36:50 Re: Postgres index usage