Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 02C27B5D944 for ; Thu, 4 Aug 2011 12:21:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 22463-03 for ; Thu, 4 Aug 2011 15:21:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 25966B5DBD9 for ; Thu, 4 Aug 2011 12:21:42 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Thu, 04 Aug 2011 10:21:41 -0500 Message-Id: <4E3A72AC020000250003FA58@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Thu, 04 Aug 2011 10:21:32 -0500 From: "Kevin Grittner" To: "Shivakumar Ramannavar" , Subject: Re: my table is empty, pg_relation_size(name) return 38 MB References: In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.616 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.716 X-Spam-Level: X-Archive-Number: 201108/18 X-Sequence-Number: 38005 Shivakumar Ramannavar wrote: > Though my table is empty, pg_relation_size(name) return 38 MB. I > use below query to determine tables disk usages. > > SELECT nspname || '.' || relname AS "Table", > pg_total_relation_size(C.oid) "Size", > pg_size_pretty(pg_total_relation_size(C.oid)) AS "Total size" > FROM pg_class C > LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) > WHERE nspname NOT IN ('pg_catalog', 'information_schema') > AND C.relkind <> 'i' > AND nspname !~ '^pg_toast' You haven't given much information, like PostgreSQL version or what has happened to the table. http://wiki.postgresql.org/wiki/Guide_to_reporting_problems My first guess, in the absence of evidence to the contrary, is that the table is taking that much space because a large number of rows were deleted from it and VACUUM hasn't been run since. Do the numbers change if you VACUUM the table explicitly? How about if you TRUNCATE it or CLUSTER it? -Kevin