Re: since when has pg_stat_user_indexes.idx_scan been counting?

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: since when has pg_stat_user_indexes.idx_scan been counting?
Date: 2011-05-12 18:18:05
Message-ID: 4DCC245D.9030001@fuzzy.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-performance

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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tomas Vondra 2011-05-12 18:19:41 Re: since when has pg_stat_user_indexes.idx_scan been counting?
Previous Message Willy-Bas Loos 2011-05-12 15:39:50 [PERFORM] since when has pg_stat_user_indexes.idx_scan been counting?

Browse pgsql-performance by date

  From Date Subject
Next Message Tomas Vondra 2011-05-12 18:19:41 Re: since when has pg_stat_user_indexes.idx_scan been counting?
Previous Message Eric McKeeth 2011-05-12 18:15:46 Re: Postgres refusing to use >1 core