| From: | Dimitri Fontaine <dfontaine(at)hi-media(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: table disk space usage query? |
| Date: | 2007-07-02 09:48:17 |
| Message-ID: | 200707021148.19799.dfontaine@hi-media.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Le jeudi 28 juin 2007, lawpoop(at)gmail(dot)com a écrit :
> Hello all -
>
> I was looking for a way to find out how much disk space each table is
> using.
As of PostgreSQL 8.1 you can use the following:
http://www.postgresql.org/docs/8.1/static/functions-admin.html#FUNCTIONS-ADMIN-DBSIZE
Example query to obtain per-table on-disk size:
select tablename,
pg_size_pretty(pg_relation_size(tablename)) as size,
pg_size_pretty(pg_total_relation_size(tablename)) as total,
pg_relation_size(tablename)
from pg_tables
where schemaname = 'public' and tablename !~ '^pg_'
order by 4 desc;
Regards,
--
dim
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Martijn van Oosterhout | 2007-07-02 11:05:35 | Re: shmctl EIDRM preventing startup |
| Previous Message | Gerhard Hintermayer | 2007-07-02 09:46:54 | ERROR: unexpected hash relation size: |