From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Shivakumar Ramannavar <shivasr@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Re: my table is empty, pg_relation_size(name) return 38 MB
Date: Thu, 04 Aug 2011 10:21:32 -0500
Message-ID: <4E3A72AC020000250003FA58@gw.wicourts.gov> (raw)
In-Reply-To: <CACdOLXY7C19fcD+ULSjXe6b_VFiGh7+MvFnninGfPA9o7kRdTQ@mail.gmail.com>
References: <CACdOLXZjY-UekAepXP98NLrxABo-nV+7ND_vQPvCbfUO9sgfvA@mail.gmail.com>
<CACdOLXY7C19fcD+ULSjXe6b_VFiGh7+MvFnninGfPA9o7kRdTQ@mail.gmail.com>
Shivakumar Ramannavar <shivasr@gmail.com> 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
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-admin@postgresql.org
Cc: Kevin.Grittner@wicourts.gov, shivasr@gmail.com
Subject: Re: my table is empty, pg_relation_size(name) return 38 MB
In-Reply-To: <4E3A72AC020000250003FA58@gw.wicourts.gov>
* 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