deeejay

PgBench - Commands

Apr 11th, 2016
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.96 KB | None | 0 0
  1. PgBench (circa 1990s)
  2. ===
  3. createdb bench = create database to test against
  4. pgbench -i bench = initialize pgbench to database (creates "banking" tables)
  5. pgbench bench
  6.  
  7. pgbench -i -s 100 bench
  8. -s = scaling factor (default: 100,000; scaling factor of 100 creates 10,000,000 rows of data)
  9.  
  10.  
  11. pgbench -T 120 -j 2 -c 20 -S bench
  12. -T = timer (in seconds) - best practice is 1 hr
  13. -j = number of jobs (# of server cores)
  14. -c = client connections (simulates 20 sessions; the more clients, the more loads on the server; # of clients should be multiple of cores)
  15. -S = Read-only (remove to test read and writes to the database)
  16. bench = database name
  17.  
  18. pgbench -T 120 -j 2 -c 20 bench
  19. this tests read/writes
  20.  
  21. Results:
  22. tps = transactions per second; higher is better
  23. Not all benchmarks will use cache; lower tps means the benchmark test might be using cache vs disk
  24.  
  25.  
  26. Run the benchmarks at least 3 times for an hour each to get a good average (Per Tom Lane - PostgreSQL maintainer)
Advertisement
Add Comment
Please, Sign In to add comment