pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tino Schwarze <postgresql@tisc.de>
To: pgsql-admin@postgresql.org
Subject: Re: Raw disk space used
Date: Wed, 1 Aug 2007 18:46:18 +0200
Message-ID: <20070801164618.GB21243@easy2.in-chemnitz.de> (raw)
In-Reply-To: <C2DB6608-F53B-4CB7-BB2C-8A61A26C2239@indiana.edu>
References: <AB1268D7-687B-45FE-84BC-B8D6B06F1975@indiana.edu>
	<60ps27bd4v.fsf@dba2.int.libertyrms.com>
	<C2DB6608-F53B-4CB7-BB2C-8A61A26C2239@indiana.edu>

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



view thread (6+ messages)  latest in thread

Message-ID: <20070801164618.GB21243@easy2.in-chemnitz.de>
Permalink:  ../20070801164618.GB21243@easy2.in-chemnitz.de/
Also on:    postgresql.org/message-id/20070801164618.GB21243@easy2.in-chemnitz.de

 · 

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: postgresql@tisc.de
  Subject: Re: Raw disk space used
  In-Reply-To: <20070801164618.GB21243@easy2.in-chemnitz.de>

* 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