Re: checking for table bloat

From: Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: checking for table bloat
Date: 2011-12-29 01:38:02
Message-ID: CAM6mieLXDPrWvChvRuunDPGB4+QZdOeE=K3n3TX=iMw8qNai=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

> As I'm sure many people know, check_postgres.pl has a wonderful (if rather
> arcane) query to check table bloat, which has been copied all over the
> intarwebz. When I try to use this query one one of my databases I'm told my
> table (which has had no deletes) is wasting a whole lot of bytes, but no
> amount of vacuuming or even clustering will make it less bloated.

You can use CTAS and re-create that table. The main issue with "check
bloat" query is that you can't relay on absolute numbers. You should
look the difference over the time (ie. run it once a day) and compare
that number to database activity (pg_stat_all_tables - n_tup_*
columns))

--
Ondrej Ivanic
(ondrej(dot)ivanic(at)gmail(dot)com)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-12-29 05:15:39 Re: Unable to Increase the column which was part of Primary key
Previous Message Ben Chobot 2011-12-29 01:16:17 checking for table bloat