Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WFon3-0004bX-C3 for pgsql-performance@arkaria.postgresql.org; Tue, 18 Feb 2014 17:49:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WFon2-0000Qq-JA for pgsql-performance@arkaria.postgresql.org; Tue, 18 Feb 2014 17:49:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WFon1-0000Qj-F6 for pgsql-performance@postgresql.org; Tue, 18 Feb 2014 17:49:03 +0000 Received: from smtp120.dfw.emailsrvr.com ([67.192.241.120]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WFomv-0006pX-Pf for pgsql-performance@postgresql.org; Tue, 18 Feb 2014 17:49:02 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 134837829F for ; Tue, 18 Feb 2014 12:48:55 -0500 (EST) X-Virus-Scanned: OK Received: by smtp2.relay.dfw1a.emailsrvr.com (Authenticated sender: david.wall-AT-yozons.com) with ESMTPSA id CFBF9782D4 for ; Tue, 18 Feb 2014 12:48:53 -0500 (EST) Message-ID: <53039D02.6010107@computer.org> Date: Tue, 18 Feb 2014 09:48:50 -0800 From: David Wall User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: DB size and TABLE sizes don't seem to add up References: <530289D4.20106@computer.org> <53031B18.5060103@vmware.com> In-Reply-To: <53031B18.5060103@vmware.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 2/18/2014 12:34 AM, Heikki Linnakangas wrote: > 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. Thanks, Heikki. It's generally even trickier for us because we have a blob table that other components use for storing large/binary/unstructured objects (the code handles compression/decompression and encryption/decryption options for us). So those tables have an UUID that points to a row in that table that contains the actual LOID. I'll use your technique to at least tell me the size for specific tables where I can build the query like you've described. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance