So far this is "pg_autotune".  It's an interesting experience this
early into the development of it, but heck, it's a start and it works.

a) You need to put the "pg_config" and "safetycatch.sh" files in the
same directory as the pgdata directory of the PostgreSQL installation
that you're testing.  You'll then need to open them up in a text editor
and do a search and replace on the pathnames to be correct.  As they're only a
few lines each this is easy.  :)

b) The program itself compiles when placed under the <postgresql source
root>/contrib/pg_autotune directory then you can run do the "gmake"
thing.  It's this way only because it originally wasn't going to be
another program, I was just going to play around with pgbench a bit...
but it kind of kept on extending...

c) Although you can disable it, it by default logs all the performance
data into a separate PostgreSQL database.  You just need to do a
"createdb metrics" then create the needed "rawdata" table inside that
using this command:

 CREATE TABLE rawdata (
         idnum SERIAL,
         maxconn INT NOT NULL,
         sharedbuffers INT NOT NULL,
         sortmem INT NOT NULL,
         vacuummem INT NOT NULL,
         systemmem INT NOT NULL,
         tuples INT NOT NULL,
         clients INT NOT NULL,
         numtransactions INT NOT NULL,
         tps FLOAT NOT NULL);

d) You'll need to setup a way for the PC you're launching from to be
able to remotely log into the PostgreSQL $DATA directory and run the
"pg_config" and "safetycatch.sh" scripts, then restart the database. 
I'm doing it by using OpenSSH dsa public and private keys between a
local pgsql account and the pgsql account on the remote system.

There are quite a few options you can set in the pg_autotune.c file that
should be broken out to the command line at some point.  Heaps of info
is in the C file itself though.

$ pg_autotune --initialise --host somehost.andrewspc.org

<stuff is output to the screen>

$ pg_autotune --host somehost.andrewspc.org

pg_autotune 1.00 - A PostgreSQL auto-tuning utility based heavily on
code by Tatsuo Ishii

Tuning will commence with these values:
        Database server to be tuned    : somehost.andrewspc.org
        Database is running on port    : 5432
        Database name on server is     : pgsql
        Database username on server is : pgsql
        Database password on server is : (null)
        Minimum shared buffers         : 64
        Maximum shared buffers         : 500
        Minimum sort memory            : 512
        Maximum sort memory            : 32768
        Minimum vacuum memory          : 8192
        Maximum vacuum memory          : 32768
        Tuning for best results with 100 concurrent clients.

        Storage database server          : localhost
        Storage database running on port : 5432
        Storage database name            : metrics
        Storage database username        : pgsql
        Storage database password        : (null)


*******

It keeps on going, changes the parameters appropriately, focusing in on
the most likely ones, etc.

If you take a look at the C file, you'll notice it's been designed for
end user extension down the track, so there's plenty of room for development.
