The postgresql statspack.
frits.hoogland@interaccess.nl

This version is strongly inspired by Glen Fawcetts version (and oracle's statspack obviously).
Some fields have been chopped off Glen's version, in order to be able to run this on a 8.1 version database.

This is work in progresql, so feel free to add features or corrections. 
Please post questions, additions or suggestions to frits.hoogland@interaccess.nl.

Installation:

1. Create or use a postgresql user which has superuser privilege
2. Create the pgstatspack tables in the database you wish to monitor, using psql
   \i pgstatspack_create_tables.sql
3. Create the pgstatspack snapshot function in the same database, using psql
   \i pgstatspack_create_snap.sql

Upgrade:

->The scripts will drop database objects prior to creating them. Already existent data will be DELETED!

1. Use the existing postgresql superuser and schema.
2. -If needed- backup existing data using pg_dump -U <user> -t 'pgstatspack*' -f pgstatspack_dump.sql <database>
3. Recreate the pgstatspack tables:
   \i pgstatspack_create_tables.sql
4. Recreate the pgstatspack snapshot function:
   \i pgstatspack_create_snap.sql 

pgstatspack is now ready.

Create snapshot:

Use the same user which is the owner of the function and the tables.

Snapshot without comment:

 select pgstatspack_snap('');

Snapshot with comment:
 
 select pgstatspack_snap('my comment');

Create a report:

Reporting is done using the pgstatspack_report.sh shellscript.

If the database username and database name are the same as your current operating system username:

./pgstatspack_report.sh

If the database username and/or the database name are different, execute pgstatspack_report.sh the following way:

./pgstatspack_report.sh <username> <database>

Next, the script displays all the snapshosts available, and asks for a begin snapshot and an end snapshot.
