public inbox for [email protected]  
help / color / mirror / Atom feed
From: SATYANARAYANA NARLAPURAM <[email protected]>
To: Raghav Mittal <[email protected]>
Cc: [email protected]
Subject: Re: Proposal: Track last-used timestamp for index usage
Date: Tue, 31 Mar 2026 19:50:26 -0700
Message-ID: <CAHg+QDdoo0u+WWuHYOnKn+ygYrg87yufiPUS_X+=0BrUEM3JYw@mail.gmail.com> (raw)
In-Reply-To: <CA+dbf3gvWCeF8j_DBjtaPcNmm=E9d_Z7sPdaJRuanGfAw2Rvow@mail.gmail.com>
References: <CA+dbf3gvWCeF8j_DBjtaPcNmm=E9d_Z7sPdaJRuanGfAw2Rvow@mail.gmail.com>

Hi Raghav,

On Tue, Mar 31, 2026 at 7:23 PM Raghav Mittal <[email protected]> wrote:

> Hi all,
>
> I’ve been exploring index usage statistics in PostgreSQL and noticed that
> pg_stat_user_indexes only provides cumulative counters (idx_scan), but not
> recency information.
>
> Problem:
> - Counters reset on restart or pg_stat_reset()
> - No way to determine when an index was last used
> - Makes it hard to safely identify unused indexes
>
> Proposal:
> Introduce lightweight tracking of last-used timestamp for indexes.
>

Could you elaborate the problem trying to solve here? As you mentioned
idx_scan already tracks the usage. Periodic snapshots should provide the
usage over a period of time. What is the purpose of exact timestamp?

Thanks,
Satya


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Proposal: Track last-used timestamp for index usage
  In-Reply-To: <CAHg+QDdoo0u+WWuHYOnKn+ygYrg87yufiPUS_X+=0BrUEM3JYw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox