Skip site navigation (1) Skip section navigation (2)

Re: Index Bloat - how to tell?

From: Mark Kirkwood <mark(dot)kirkwood(at)catalyst(dot)net(dot)nz>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Index Bloat - how to tell?
Date: 2010-12-14 22:20:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On 15/12/10 09:12, Dave Crooke wrote:
> There is a plugin called pgstattuple which can be quite informative 
> .... however, it actually does a full scan of the table / index files, 
> which may be a bit invasive depending on your environment and load.
> It's in the contrib (at least for 8.4), and so you have to import its 
> functions into your schema using the script in the contrib directory.

If you are using 8.4 or later, try the Freespacemap module:

I tend to run this query:

         SELECT oid::regclass,
                pg_relation_size(oid)/(1024*1024) AS mb,
                sum(free)/(1024*1024) AS free_mb
             (SELECT oid, (pg_freespace(oid)).avail AS free
              FROM pg_class) AS a
         GROUP BY a.oid ORDER BY free_mb DESC;

to show up potentially troublesome amounts of bloat.



In response to

pgsql-performance by date

Next:From: AI RummanDate: 2010-12-15 06:56:32
Subject: only one index is using, why?
Previous:From: Dave CrookeDate: 2010-12-14 20:12:11
Subject: Re: Index Bloat - how to tell?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group