For those who care. Here is how you determine the disk space used for each
postgresql db.

#!/bin/bash

# scan the list of databases and provide the disk space used in human
readable form

dbs=`psql template1 -tc "select datname from pg_database"|sed s/" "/""/g`

for i in $dbs
do
oid=`psql template1 -tc "select oid from pg_database where datname =
'$i'"|sed s/" "/""/g`
echo "$i = "`du -sh "/var/lib/postgres/data/base/$oid"|awk '{print $1}'`
done


Tony


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to