PostgreSQL > pgbenchの使い方
更新日
2014-02-10
広告
インストール
以下はapt-getでのインストール例です。$ sudo install postgresql postgresql-client postgresql-contrib
準備
ベンチマーク用のデータベースを作ります。$ createdb -h localhost -U postgres bench_table
データベースの初期化
$ pgbench -h localhost -U postgres -i bench_table
ベンチマーク
とりあえず、以下の2つのオプションを指定すれば、ベンチマークできます。- -c : データベースにアクセスするクライアントの数
- -t : 各クライアントが実行するトランザクション数
$ pgbench -h localhost -U postgres -c 10 -t 1000 bench_table starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 1 query mode: simple number of clients: 10 number of threads: 1 number of transactions per client: 1000 number of transactions actually processed: 10000/10000 tps = 245.746034 (including connections establishing) tps = 246.832832 (excluding connections establishing)
広告
お問い合わせは sweng.tips@gmail.com まで。