pgbench的编译和安装

    PostgreSQL数据库提供了一款轻量级的压力测试工具pgbench。pgbench通常会开多个数据库 Session, 并且在测试最后形成测试报告,得出每秒平均事务数。pgbench可以测试 select,update,insert,delete 命令。

    安装环境:CentOS 6.5 (Final),PostgreSQL9.2.24,virtualbox 5.2.18 。

1.下载源码包

[root@April ~]# wget https://ftp.postgresql.org/pub/source/v9.2.24/postgresql-9.2.24.tar.gz

2.解压

[root@April ~]# tar zxvf postgresql-9.2.24.tar.gz

3.进入pgbench安装包

[root@April ~]# cd postgresql-9.2.24/contrib/pgbench/

   查看安装包内的文件

[root@April pgbench]# ll
total 152
-rw-r--r--. 1 1107 1107   538 Nov  7  2017 Makefile
-rwxr-xr-x. 1 root root 46789 Apr  2 15:16 pgbench
-rw-r--r--. 1 1107 1107 64397 Nov  7  2017 pgbench.c
-rw-r--r--. 1 root root 34880 Apr  2 15:09 pgbench.o

4.编译和安装

[root@April pgbench]# make all
[root@April pgbench]# make install

5.相关参数

[root@April pgbench]# ./pgbench --help
pgbench is a benchmarking tool for PostgreSQL.

Usage:
  pgbench [OPTION]... [DBNAME]

Initialization options:
  -i           invokes initialization mode
  -F NUM       fill factor
  -s NUM       scaling factor
  --index-tablespace=TABLESPACE
               create indexes in the specified tablespace
  --tablespace=TABLESPACE
               create tables in the specified tablespace
  --unlogged-tables
               create tables as unlogged tables

Benchmarking options:
  -c NUM       number of concurrent database clients (default: 1)
  -C           establish new connection for each transaction
  -D VARNAME=VALUE
               define variable for use by custom script
  -f FILENAME  read transaction script from FILENAME
  -j NUM       number of threads (default: 1)
  -l           write transaction times to log file
  -M simple|extended|prepared
               protocol for submitting queries to server (default: simple)
  -n           do not run VACUUM before tests
  -N           do not update tables "pgbench_tellers" and "pgbench_branches"
  -r           report average latency per command
  -s NUM       report this scale factor in output
  -S           perform SELECT-only transactions
  -t NUM       number of transactions each client runs (default: 10)
  -T NUM       duration of benchmark test in seconds
  -v           vacuum all four standard tables before tests

Common options:
  -d             print debugging output
  -h HOSTNAME    database server host or socket directory
  -p PORT        database server port number
  -U USERNAME    connect as specified database user
  -V, --version  output version information, then exit
  -?, --help     show this help, then exit

Report bugs to <pgsql-bugs@postgresql.org>.

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值