pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: pgsql-performance@postgresql.org
To: Lance Campbell <lance@uiuc.edu>
Subject: Re: index stat
Date: Wed, 07 Nov 2007 10:32:15 -0600
Message-ID: <4731942E.EE98.0025.0@wicourts.gov> (raw)
In-Reply-To: <B10E6810AC2A2F4EA7550D072CDE8760197DD5@SAB-FENWICK.sab.uiuc.edu>
References: <B10E6810AC2A2F4EA7550D072CDE8760197DD5@SAB-FENWICK.sab.uiuc.edu>

>>> On Mon, Nov 5, 2007 at 10:42 AM, in message
<B10E6810AC2A2F4EA7550D072CDE8760197DD5@SAB-FENWICK.sab.uiuc.edu>, "Campbell,
Lance" <lance@uiuc.edu> wrote: 

> How can I [. . .] get rid of some unnecessary indexes
 
Here's what I periodically run to look for unused indexes:
 
select relname, indexrelname
  from pg_stat_user_indexes
  where indexrelname not like '%_pkey'
    and idx_scan = 0
  order by relname, indexrelname
;
 
We omit the primary keys from the list (based on our naming
convention) because they are needed to ensure integrity.
 
-Kevin
 





view thread (2+ messages)

Message-ID: <4731942E.EE98.0025.0@wicourts.gov>
Permalink:  ../4731942E.EE98.0025.0@wicourts.gov/
Also on:    postgresql.org/message-id/4731942E.EE98.0025.0@wicourts.gov

 · 

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: Kevin.Grittner@wicourts.gov, lance@uiuc.edu
  Subject: Re: index stat
  In-Reply-To: <4731942E.EE98.0025.0@wicourts.gov>

* 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