PG数据库提供了一款轻量级的压力测试工具叫pgbench,其实就是一个编译好后的扩展性的可执行文件。介绍如下。
环境:
CentOS 5.7(final)
PG:9.1.2
Vmware 8.0
环境:
CentOS 5.7(final)
PG:9.1.2
Vmware 8.0
数据库参数: max_connection=100 ,其他略,默认
1.安装
进入源码安装包,编译,安装
[postgres@localhost ~]$ cd postgresql-9.1.2/contrib/pgbench/ [postgres@localhost pgbench]$ ll total 164 -rw-r--r--. 1 postgres postgres 538 Dec 1 2011 Makefile -rwxrwxr-x. 1 postgres postgres 50203 Apr 26 23:50 pgbench -rw-r--r--. 1 postgres postgres 61154 Dec 1 2011 pgbench.c -rw-rw-r--. 1 postgres postgres 47920 Apr 26 23:50 pgbench.o [postgres@localhost pgbench]$make all [postgres@localhost pgbench]$make install安装完毕以后可以在bin文件夹下看到新生成的pgbench文件
[postgres@localhost bin]$ ll $PGHOME/bin pgbench
-rwxr-xr-x. 1 postgres postgres 50203 Jul 8 20:28 pgbench