Search Postgresql Archives

Re: table disk space usage query?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le jeudi 28 juin 2007, lawpoop@xxxxxxxxx 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

Attachment: signature.asc
Description: This is a digitally signed message part.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux