Skip to content

Instantly share code, notes, and snippets.

@akhdaniel
Created April 29, 2021 23:51
Show Gist options
  • Save akhdaniel/4c482b7ec92f7f23fb1bc4d619761f39 to your computer and use it in GitHub Desktop.
Save akhdaniel/4c482b7ec92f7f23fb1bc4d619761f39 to your computer and use it in GitHub Desktop.
PG Bench

Install

apt-get install postgresql postgresql-contrib

Create DB

su - postgres
psql 
CREATE DATABASE example

Init pgbench

pgbench -i -s 50 example

Create Baseline

pgbench -c 10 -j 2 -t 10000 example

c = number of clients j = pgbench worker process t = number of transactions to execute

To summarize, the baseline test run was two pgbench worker processes simulating 10,000 transactions from 10 clients for a total of 100,000 transactions.

Sample Result:

starting vacuum...end.
transaction type: TPC-B (sort of)
scaling factor: 50
query mode: simple
number of clients: 10
number of threads: 2
number of transactions per client: 10000
number of transactions actually processed: 100000/100000
latency average: 4.176 ms
tps = 2394.718707 (including connections establishing)
tps = 2394.874350 (excluding connections establishing)

Note: Increase shared_buffers to increase TPS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment