Search Postgresql Archives

Re: strange table disk sizes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 1, 2011 at 4:32 AM, Rik Bellens <rik.bellens@xxxxxxxxxxxxxx> wrote:
>
> Hello,
>
> I have two large tables in a database, one containing original data and the
> other one derived from the first table. The first table contains several
> columns and indexes, while the second table has less columns and only one
> index. Both tables have the same number of rows. Nevertheless, the second
> table is much larger in disk size than the first one. How can this be
> explained?

This is most likely due to table bloat.  In PostgreSQL when you update
or delete a row, a dead version gets left behind.  Vacuum eventually
comes along and reclaims the empty space to be reused.  If you delete
/ update a LOT of rows at once, then you'll have a lot of dead rows
which can only be reused after vacuuming when you do more updates or
deletes later on.

A few salient questions. What version of PostgreSQL are you running?
Is autovacuum running? Do you do a LOT of bulk deletes / updates?  If
you do a lot of bulk deletes on this table, and you delete everything,
can you switch to using the truncate command instead?

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux