Re: finding unused indexes?

From: Brad Nicholson <bnichols(at)ca(dot)afilias(dot)info>
To: George Pavlov <gpavlov(at)mynewplace(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: finding unused indexes?
Date: 2006-08-01 16:11:47
Message-ID: 1154448707.2624.11.camel@dba5.int.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 2006-08-01 at 09:05 -0700, George Pavlov wrote:
> Anybody have a clever way to quickly find whether there are any unused
> indexes in a PG DB? One way I have done is to take queries from the DB
> log, prepend an explain to each and grep the results, but I am wondering
> if there are either any index usage stats maintained somewhere inside
> Postgres or if there is a slicker/less cumbersome way of doing it. Also
> indexes used by functions are hard to simulate that way.
>

Check out pg_stat_user_indexes, pg_stat_sys_indexes and
pg_statio_all_indexes

You can very clearly see the index usage there. You might have to mess
with the statistics collector section in the postgresql.conf file in
order to collect the information.

Brad.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Aaron Bono 2006-08-01 19:32:54 Re: Joining a result set from four (4) tables
Previous Message Jim Buttafuoco 2006-08-01 16:10:01 Re: finding unused indexes?