pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joshua D. Drake <jd@commandprompt.com>
To: adey <adey11@gmail.com>
Cc: chuck.amadi@rokcorp.com, postgresql <pgsql-admin@postgresql.org>
Subject: Re: Checking a size of a given database
Date: Tue, 17 Apr 2007 21:23:57 -0700
Message-ID: <46259D5D.3020203@commandprompt.com> (raw)
In-Reply-To: <1c66bda80704172118k52d45afchccbbe7e4ea5ec2a9@mail.gmail.com>
References: <4624A530.40108@rokcorp.com>
	<1c66bda80704172118k52d45afchccbbe7e4ea5ec2a9@mail.gmail.com>

adey wrote:
> I found the following script useful; for calculating database size:-

select pg_database_size?

http://www.postgresql.org/docs/8.2/static/functions-admin.html

>  
> -- Query returns size of a database calculated from the no. 8k pages 
> allocated to tables
> SELECT 
>  sum( relpages*8/1024 ) as MB
> FROM
>  pg_class
> WHERE
> -- relname != ''
> -- relname = 'tablename'
>  relnamespace = '2200'
> 
>  
> On 4/17/07, *Chuck Amadi* <chuck.amadi@rokcorp.com 
> <mailto:chuck.amadi@rokcorp.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.
> 
>     Cheers
>     Chuck
> 
>     --
>     Chuck Amadi
>     ROK Corporation Limited
>     Ty ROK,
>     Dyffryn Business Park,
>     Llantwit Major Road,
>     Llandow,
>     Vale Of Glamorgan.
>     CF71 7PY
> 
>     Tel: 01446 795 839
>     Fax: 01446 794 994
>     International Tel:   +44 1446 795 839
> 
>     email: chuck.amadi@rokcorp.com <mailto:chuck.amadi@rokcorp.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
>           match
> 
> 


-- 

       === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive  PostgreSQL solutions since 1997
              http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/




view thread (6+ messages)  latest in thread

Message-ID: <46259D5D.3020203@commandprompt.com>
Permalink:  ../46259D5D.3020203@commandprompt.com/
Also on:    postgresql.org/message-id/46259D5D.3020203@commandprompt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: jd@commandprompt.com, adey11@gmail.com
  Subject: Re: Checking a size of a given database
  In-Reply-To: <46259D5D.3020203@commandprompt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox