pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: David Wall <d.wall@computer.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: DB size and TABLE sizes don't seem to add up
Date: Tue, 18 Feb 2014 10:34:32 +0200
Message-ID: <53031B18.5060103@vmware.com> (raw)
In-Reply-To: <530289D4.20106@computer.org>
References: <530289D4.20106@computer.org>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On 02/18/2014 12:14 AM, David Wall wrote:
> I am running PG 9.2.4 and I am trying to figure out why my database size
> shows one value, but the sum of my total relation sizes is so much less.
>
> Basically, I'm told my database is 188MB, but the sum of my total
> relation sizes adds up to just 8.7MB, which is 1/20th of the reported
> total.  Where is the 19/20th of my data then?  We do make significant
> use of large objects, so I suspect it's in there.  Is there a relation
> size query that would include the large object data associated with any
> OIDs in those tables?

You can use "select pg_total_relation_size('pg_largeobject')" to get the 
total size of the large objects. Attributing large objects to the tables 
that refer them is more difficult. For a single table, something like this:

select sum(pg_column_size(lo.data))
from lotest_stash_values t, pg_largeobject lo
where lo.loid = t.loid;

Replace "lotest_stash_values" with the table's name and lo.loid with the 
name of the OID column.

- Heikki


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



view thread (3+ messages)  latest in thread

Message-ID: <53031B18.5060103@vmware.com>
Permalink:  ../53031B18.5060103@vmware.com/
Also on:    postgresql.org/message-id/53031B18.5060103@vmware.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: hlinnakangas@vmware.com, d.wall@computer.org
  Subject: Re: DB size and TABLE sizes don't seem to add up
  In-Reply-To: <53031B18.5060103@vmware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox