[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: postgresql database file names

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


# 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
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}'`


Reply to: