How do I determine how much space is being used by the PostgreSQL database?

First, determine where your postgresql database is installed. Here are the default locations for common platforms:

  • AIX: /u2/pgsql
  • RHEL (postgresql 8.1): /var/lib/pgsql/
  • RHEL (postgresql 8.4): /opt/PostgresPlus/

Once you have determined where the postgresql database lives, use the UNIX du command to report how much space is currently being used by the database files. Here’s an example from a RHEL server with postgresql 8.1 showing a database using 125 MB of data:

[root@firestorm ~]# du -sm /var/lib/pgsql/
125     /var/lib/pgsql/