Benchmarking with PGBench: TPS results.

pgbench is not the best tools to benchmark postgres but it’s
the one shipped by default with postgres.
It does not do a good job for benchmarking your “web apps” SQL wise, it will give you some
good indication about how fast is your server for postgres.

Here are some results we have collected using theses options :

pgbench -Uuser  -s 10 -c 10 -t 3000 benchmark

We configure servers with RAID 1+0 with write-cache and a battery
backup, we have tested with postgres 8.1.5 and here are the best
results for different type of servers :

IBM x3650 : 729tps
HP DL385 : 717tps
Dell PowerEdge 2950: 708tps

Get size of Postgres DB from filesystem

Get the size accurately from postgres local filesystem, i guess there is some sql stuff that can do that but that does the job as well for me :

#!/bin/bash
/usr/lib/postgresql/8.1/bin/oid2name  -U postgres|while read -a e;do
name=${e[1]}
oid=${e[0]}
[[ $oid == "All" || $oid == "Oid" || -z $oid || -z $name ]] && continue
typeset -a size
size=(`du -s /var/lib/postgresql/8.1/main/base/$oid`)
size=${size[0]}
printf "%-20s %-20s\n" ${name} ${size}
done | sort -n -r -k 2 |awk '{printf "%-20s%20d Mb\n", $1, $2 / 1024}'