Detemine database size on Postgres 8.0

From: Thom Brown <thombrown(at)gmail(dot)com>
To: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Detemine database size on Postgres 8.0
Date: 2009-03-02 15:25:27
Message-ID: bddc86150903020725k45b66044n386d47cab9574f31@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

We have a database server which is on version 8.0.12. I was wondering if
anyone knows of a way to tell the size of each database?

I've tried:
select pg_size_pretty(pg_database_size('test'));

which doesn't work because pg_database_size is unrecognised. And I've
tried:

select *
from (
select pc.RelName as "ObjectName"
,pt.spclocation || '/' || pc.relfilenode as "PhysLoc"
,pc.relfilenode as "DirNum"
,pc.relkind as "ObjectType"
,(pc.relpages * 8)/1024 as "MBUsed"
,pc.reltuples as "NumRows"
from pg_roles pr
join pg_class pc
on pr.oid = pc.relowner
join pg_tablespace pt
on pr.oid = pt.spcowner
and pc.reltablespace = pt.oid
where pr.rolname = 'EMS_SA'
and pc.relkind in ('r','i')
order by pc.relname
) a
where 1 = 1
--and "DirNum" = 66252
--and "ObjectName" like '%Encrypted_Data%'
and "ObjectType" = 'r'
order by "MBUsed" desc
,"NumRows" desc

which doesn't work because pg_roles doesn't exist.

Thanks

Thom

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hiroshi Saito 2009-03-02 15:35:37 Re: encoding of PostgreSQL messages
Previous Message Reid Thompson 2009-03-02 15:21:26 Re: Matching against a field case in-sensitive.