PostgreSQL数据库压力测试工具pgbench简单应用

本文介绍了PostgreSQL数据库的压力测试工具pgbench的使用,包括安装、参数介绍、测试数据初始化及不同session数量下的测试过程,详细展示了从1个到100个session的性能测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

PG数据库提供了一款轻量级的压力测试工具叫pgbench,其实就是一个编译好后的扩展性的可执行文件。介绍如下。 
 环境: 
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


2.参数介绍

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值