Re: db size and tables size difference

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Isabella Ghiurea <isabella(dot)ghiurea(at)nrc-cnrc(dot)gc(dot)ca>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: db size and tables size difference
Date: 2009-09-23 16:42:00
Message-ID: 3537.1253724120@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Isabella Ghiurea <isabella(dot)ghiurea(at)nrc-cnrc(dot)gc(dot)ca> writes:
> SELECT nspname || '.' || relname AS
> "relation",pg_size_pretty(pg_total_relation_size(nspname || '.' || relname))
> AS "s
> ize"
> FROM pg_class C
> LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
> ORDER BY pg_total_relation_size(nspname || '.' || relname) DESC
> LIMIT 1000;

Hmph ... I can't see anything wrong with that query, so it seems that
we're left with the conclusion that there are files in the database
directory that don't match any entry in the catalogs. AFAIK this'd
only be possible if you'd had a crash while deleting tables or some
similar problem. What you'll need to do next is poke around in the
data directory and see if you can identify any large files that do
not correspond to any entry in pg_class.relfilenode. You should
read the internals docs first, if you're not familiar with this
chapter:
http://www.postgresql.org/docs/8.3/static/storage.html

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Isabella Ghiurea 2009-09-23 22:11:05 Re: db size and tables size difference
Previous Message Isabella Ghiurea 2009-09-23 16:24:21 Re: db size and tables size difference