pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedmy table is empty, pg_relation_size(name) return 38 MB
3+ messages / 2 participants
[nested] [flat]
* my table is empty, pg_relation_size(name) return 38 MB
@ 2011-08-04 11:22 Shivakumar Ramannavar <shivasr@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Shivakumar Ramannavar @ 2011-08-04 11:22 UTC (permalink / raw)
To: pgsql-admin
Hi Team,
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'
Please help,
Thanks!
Shiva
--
Shivakumar Ramannavar
^ permalink raw reply [nested|flat] 3+ messages in thread
* my table is empty, pg_relation_size(name) return 38 MB
@ 2011-08-04 11:24 Shivakumar Ramannavar <shivasr@gmail.com>
parent: Shivakumar Ramannavar <shivasr@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Shivakumar Ramannavar @ 2011-08-04 11:24 UTC (permalink / raw)
To: pgsql-admin
Hi Team,
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'
Please help,
Thanks!
Shiva
--
Shivakumar Ramannavar
--
Shivakumar Ramannavar
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: my table is empty, pg_relation_size(name) return 38 MB
@ 2011-08-04 15:21 Kevin Grittner <Kevin.Grittner@wicourts.gov>
parent: Shivakumar Ramannavar <shivasr@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Kevin Grittner @ 2011-08-04 15:21 UTC (permalink / raw)
To: Shivakumar Ramannavar <shivasr@gmail.com>; pgsql-admin
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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2011-08-04 15:21 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04 11:22 my table is empty, pg_relation_size(name) return 38 MB Shivakumar Ramannavar <shivasr@gmail.com>
2011-08-04 11:24 ` Shivakumar Ramannavar <shivasr@gmail.com>
2011-08-04 15:21 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
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