Re: determining database size

From: Joe Conway <mail(at)joeconway(dot)com>
To: Jeff Davis <list-pgsql-general(at)dynworks(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: determining database size
Date: 2002-04-17 19:57:55
Message-ID: 3CBDD3C3.2090608@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Davis wrote:
> I would just like to know how to determine the size of a database. The
> directories inside the data directory are numerical, so I can't associate
> them with a particular database or table.
>
> I would basically just like to create reports so I can determine how fast the
> disk usage is increasing.
>
> Any suggestions?
>

Try:
test=# select oid, datname from pg_database;
oid | datname
-------+-----------
16613 | test
1 | template1
16560 | template0
16671 | test2

[postgres(at)jec-linux dblink]$ cd $PGDATA
[postgres(at)jec-linux data]$ cd base
/opt/data/pgsql/data/base
[postgres(at)jec-linux base]$ ls
total 24
drwx------ 6 postgres postgres 4096 Apr 16 10:44 .
drwx------ 6 postgres postgres 4096 Apr 17 10:53 ..
drwx------ 2 postgres postgres 4096 Apr 16 10:43 1
drwx------ 2 postgres postgres 4096 Apr 16 10:42 16560
drwx------ 2 postgres postgres 4096 Apr 16 10:44 16613
drwx------ 2 postgres postgres 4096 Apr 16 10:44 16671

And you can see which directory is which database. There is also
something in ~/pgsql/contrib/oid2name that you might want to look at
(never used it myself though).

HTH,

Joe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nigel J. Andrews 2002-04-17 20:02:02 Re: determining database size
Previous Message Nigel J. Andrews 2002-04-17 19:56:07 Re: select users in a group?