pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tv@fuzzy.cz>
To: pgsql-performance@postgresql.org
Subject: Re: since when has pg_stat_user_indexes.idx_scan been counting?
Date: Thu, 12 May 2011 20:18:05 +0200
Message-ID: <4DCC245D.9030001@fuzzy.cz> (raw)
In-Reply-To: <BANLkTikhNLPhCjE819=RFG-+CB6UV4GbUA@mail.gmail.com>
References: <BANLkTikhNLPhCjE819=RFG-+CB6UV4GbUA@mail.gmail.com>

Dne 12.5.2011 17:39, Willy-Bas Loos napsal(a):
> Hi,
> 
> We have some indexes that don't seem to be used at all.
> I'd like to know since when they have not been used.
> That is, the time when postgres started counting to reach the number
> that is in pg_stat_user_indexes.idx_scan
> 
> Is there a way to retrieve that from the database ?

Well, not really :-( You could call pg_postmaster_start_time() to get
the start time, but that has two major drawbacks

(1) The stats may be actually collected for much longer, because restart
does not reset them.

(2) If someone called pg_stat_reset(), the stats are lost but the start
time remains the same.

So there really is no reliable way to do detect this.

In 9.1 this is not true - there's a timestamp for each database (and
global stats) to keep track of the last reset.

regards
Tomas



view thread (10+ messages)  latest in thread

Message-ID: <4DCC245D.9030001@fuzzy.cz>
Permalink:  ../4DCC245D.9030001@fuzzy.cz/
Also on:    postgresql.org/message-id/4DCC245D.9030001@fuzzy.cz

 · 

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: pgsql-performance@postgresql.org
  Cc: tv@fuzzy.cz
  Subject: Re: since when has pg_stat_user_indexes.idx_scan been counting?
  In-Reply-To: <4DCC245D.9030001@fuzzy.cz>

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

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