Re: database size much bigger than tablespaces on filesystem

From: Rob Audenaerde <Rob(dot)Audenaerde(at)Valuecare(dot)nl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: database size much bigger than tablespaces on filesystem
Date: 2011-09-14 16:04:29
Message-ID: 1D020918205F334CBDD5CE7DF2038A2E15A581245C@IE2RD2XVS271.red002.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

>>>> I check te database size like this:
>>>> select pg_size_pretty(pg_database_size('database'))
>>>> 595 GB

>>> You should also check the space held in $PGDATA/base.

>> I did. It is only 320 MB.

>Bizarre. Try breaking the results down table-by-table to see if you can
>find where the discrepancy is.

> regards, tom lane

It gets stranger. I try this:

select
tablename
, pg_relation_size(tablename)
, pg_size_pretty(pg_relation_size(tablename) ) as relsize
, pg_size_pretty(pg_total_relation_size(tablename) ) as disksize
, pg_total_relation_size(tablename)
from pg_tables where schemaname <> 'information_schema'
order by 2 desc

And all the tables report a 'disksize' larger than the 'relsize', which seems natural. The biggest table (relsize) is around 5 GB.
I wonder where the rest of the size comes from?

-Rob

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Steve Crawford 2011-09-14 18:06:52 Re: pg_upgrade difficulties
Previous Message Steve Crawford 2011-09-14 15:48:07 Re: pg_upgrade difficulties