Re: Raw disk space used

From: Carol Walter <walterc(at)indiana(dot)edu>
To: Tino Schwarze <postgresql(at)tisc(dot)de>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Raw disk space used
Date: 2007-08-01 17:51:38
Message-ID: 454E048C-4C10-4E10-B8A5-74FEF96C652F@indiana.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Oh, that's way cool. Thanks for the script.

Carol
On Aug 1, 2007, at 12:46 PM, Tino Schwarze wrote:

> On Wed, Aug 01, 2007 at 12:34:07PM -0400, Carol Walter wrote:
>
>> I've done as you suggested and I've got the correct directories. I
>> have a second question now. There are forty-four numeric entries in
>> the directory for the first databases that I looked at. The database
>> in question has only eight tables. There are eight tables that have
>> recent dates. Do I need the total of all the files or just the eight
>> that appear to be the tables that are being updated?
>
> Take the whole directory - there are indexes as well. And large tables
> are split up AFAIK.
>
> You may try the following shell script to determine the size of all
> databases:
>
> #!/bin/bash
> #
> # Shell script to determine disk usage of PostgreSQL databases.
> # by Tino Schwarze/Community4you
>
> PGDATADIR=/data/pgsql/74
> PGPORT=5432
> PSQLBIN=/opt/pgsql-7.4.3/bin/psql
> PGOPTS="-U postgres"
>
> echo "PostgreSQL 7.4.3 database sizes"
> $PSQLBIN $PGOPTS -p $PGPORT -t -F " " -A template1 -c 'select
> oid,datname from pg_database' | \
> while read oid dbname ; do
> [ "$dbname" != "template1" ] || continue
> [ "$dbname" != "template0" ] || continue
> size="`du -sh $PGDATADIR/base/$oid | cut -f 1`"
> while [ ${#dbname} -lt 16 ] ; do dbname="$dbname
> " ; done
> printf "$dbname\t%6s\n" $size
> done
>
>
> HTH,
>
> Tino.
>
> --
> www.quantenfeuerwerk.de
> www.spiritualdesign-chemnitz.de
> www.lebensraum11.de
>
> Tino Schwarze * Parkstraße 17h * 09120 Chemnitz
>
> ---------------------------(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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Alvaro Herrera 2007-08-01 18:05:52 Re: stracing a connection
Previous Message Benjamin Krajmalnik 2007-08-01 17:43:53 Deadlock