From: | Oli Sennhauser <oli(dot)sennhauser(at)bluewin(dot)ch> |
---|---|
To: | Robert <rjyoung(at)scs(dot)carleton(dot)ca> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Database size with postgres 7.2 |
Date: | 2004-01-08 19:44:58 |
Message-ID: | 3FFDB33A.9080207@bluewin.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hi Robert
> I'm hoping to find a easy way to find the disk space used by each
> database on a given postgres v7.2 server - I've been looking through
> the docs and have seen some references to oid2name, but that doesn't
> really help my situation.
This script gives you the used size per object. Unfortunately only for
the actual db. If it also works on 7.2: I do not know (old stuff)
--
-- Amount of space per object used after vacuum
--
\echo
\echo 'Caution: This skript does only print usefull information'
\echo ' if you run VACUUM before!'
\echo
--VACUUM;
SELECT c1.relname AS "tablename", c2.relname AS "indexname",
c2.relpages * 8 AS "size_kb", c2.relfilenode AS "filename"
FROM pg_class c1, pg_class c2, pg_index i
WHERE c1.oid = i.indrelid
AND i.indexrelid = c2.oid
UNION
SELECT relname, NULL, relpages * 8, relfilenode
FROM pg_class
WHERE relkind = 'r'
ORDER BY tablename, indexname DESC, size_kb;
Does it help?
Regards Oli
-------------------------------------------------------
Oli Sennhauser
Database-Engineer (Oracle & PostgreSQL)
Rebenweg 6
CH - 8610 Uster / Switzerland
Phone (+41) 1 940 24 82 or Mobile (+41) 79 450 49 14
e-Mail oli(dot)sennhauser(at)bluewin(dot)ch
Website http://mypage.bluewin.ch/shinguz/PostgreSQL/
Secure (signed/encrypted) e-Mail with a Free Personal SwissSign ID: http://www.swisssign.ch
Import the SwissSign Root Certificate: http://swisssign.net/cgi-bin/trust/import
From | Date | Subject | |
---|---|---|---|
Next Message | Robert | 2004-01-08 23:56:24 | Re: Database size with postgres 7.2 |
Previous Message | Robert | 2004-01-08 17:55:14 | Database size with postgres 7.2 |