PostgreSQL 性能测试工具

前端之家收集整理的这篇文章主要介绍了PostgreSQL 性能测试工具前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

postgresql 自带性能测试工具 pgbench
pgbench 是 postgresql 自带的交互性能测试工具。用于测试postgresql数据库性能
为了测试postgresql数据库性能,简单测试如下

  1. bash-4.2$ pgbench --help
  2. pgbench is a benchmarking tool for Postgresql.
  3.  
  4. Usage:
  5. pgbench [OPTION]... [DBNAME]
  6.  
  7. Initialization options:
  8. -i invokes initialization mode -F NUM fill factor -s NUM scaling factor --index-tablespace=TABLESPACE create indexes in the specified tablespace
  9. --tablespace=TABLESPACE create tables in the specified tablespace
  10. --unlogged-tables create tables as unlogged tables
  11.  
  12. Benchmarking options:
  13. -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
  14. -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)
  15. -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
  16. Common options:
  17. -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
  18. Report bugs to <pgsql-bugs@postgresql.org>.

  1. pgbench -i pgbench

生成8千万数据的测试库

  1. pgbench -i -s 800 pgbench

生成20亿测试数据(海量数据生成生成速度看机器配置)

  1. pgbench -i-s 20000 pgbench

单独安装,postgresql94-contrib

  1. yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm
  1. yum install postgresql94-contrib

猜你在找的Postgre SQL相关文章