I found the following script useful; for calculating database size:-
-- Query returns size of a database calculated from the no. 8k pages
allocated to tables
sum( relpages*8/1024 ) as MB
-- relname != ''
-- relname = 'tablename'
relnamespace = '2200'
On 4/17/07, Chuck Amadi <chuck(dot)amadi(at)rokcorp(dot)com> wrote:
> I have been given a task to try a proof of concept of migrating are active
> databases from PostgreSQL 8.0.1 to 8.2.3
> I will install and configPostgreSQL on my local w/s and replicate the
> database users etc etc.
> I have had a look inside /var/lib/pgsql/data/base and there are
> numerous files (db's) which I believe is where I can check data base size.
> 1 108012 114465 122407 1261267 1261963 17229 17233 17234 17235 174066 19247 205009 21272 2793694 2794334 333245 333375
> I am aware that Postgresql creates directories to keep each database in.
> These directories aren't names,they are kept as the *'OID's *of each
> database (oid's are*"object identifiers"*).
> Previously I just run pg_dump and thus run ls -lh on the db dump. Anyway
> of checking a size of a given database I have tried
> the sql using select pg_database_size ('dbaname'); but no joy.
> Chuck Amadi
> ROK Corporation Limited
> Ty ROK,
> Dyffryn Business Park,
> Llantwit Major Road,
> Vale Of Glamorgan.
> CF71 7PY
> Tel: 01446 795 839
> Fax: 01446 794 994
> International Tel: +44 1446 795 839
> email: chuck(dot)amadi(at)rokcorp(dot)com
> This email is confidential to the addressee only. If you do not believe
> that you are the intended recipient, do not pass it on or copy it in any
> way. Please delete it immediately.
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
In response to
pgsql-admin by date
|Next:||From: adey||Date: 2007-04-18 04:19:28|
|Subject: Re: Cript for DISK SPACE USE psql|
|Previous:||From: Robert Treat||Date: 2007-04-18 02:02:22|
|Subject: Re: Return data from function|