pgbench(postgresql压力测试工具)
PostgreSQL 10分区表详解及性能测试报告
PostgreSQL10分区表性能研究报告-哈啰
PostgreSQL分区表上的性能测试–第3部分

脚本

  1. \set aid random(1, 100000 * :scale)
  2. \set bid random(1, 1 * :scale)
  3. \set tid random(1, 10 * :scale)
  4. \set delta random(-5000, 5000)
  5. BEGIN;
  6. UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
  7. SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
  8. UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
  9. UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
  10. INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
  11. END;