当前位置:网站首页>pgbench基准测试《postgresql》
pgbench基准测试《postgresql》
2022-07-28 21:19:00 【liuyunshengsir】
pgbench是一种在PostgreSQL上运行基准测试的简单程序。它可能在并发的数据库会话中一遍一遍地运行相同序列的 SQL 命令,并且计算平均事务率(每秒的事务数)。默认情况下,pgbench会测试一种基于 TPC-B 但是要更宽松的场景,其中在每个事务中涉及五个SELECT、UPDATE以及INSERT命令。但是,通过编写自己的事务脚本文件很容易用来测试其他情况。
1.修改pg_hba.conf
host all all 10.6.8.0/24 trust
systemctl status postgresql-13
2.测试
2.1初始化
[[email protected] data]# /usr/pgsql-13/bin/pgbench -i --unlogged-tables -s 2 -U user001 -p 5432 -d db001 -h 10.6.8.238
dropping old tables...
creating tables...
generating data (client-side)...
200000 of 200000 tuples (100%) done (elapsed 0.07 s, remaining 0.00 s)
vacuuming...
creating primary keys...
done in 0.57 s (drop tables 0.03 s, create tables 0.03 s, client-side generate 0.24 s, vacuum 0.14 s, primary keys 0.12 s).
2.2 执行压力测试
-M prepared表示绑定变量形式的调用SQL,-r表示报告测试文件中每条SQL的平均执行延迟,
-c 8表示模拟8个客户端,-j 2表示pgbench的工作线程是2个,
-T 10表示压力测试的时间是10秒,-l表示把事务统计写入log,其余的是postgres连接相关的参数
以上参数,也可以结合命令帮助看出来
/usr/pgsql-13/bin/pgbench -M prepared -r -c 8 -j 2 -T 10 -U user001 -h 10.6.8.238 -p 5432 -d db001 -l
执行结果
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 2
query mode: prepared
number of clients: 8
number of threads: 2
duration: 10 s
number of transactions actually processed: 10945
latency average = 7.721 ms
tps = 1036.127306 (including connections establishing)
tps = 1036.693062 (excluding connections establishing)
statement latencies in milliseconds:
0.017 \set aid random(1, 100000 * :scale)
0.015 \set bid random(1, 1 * :scale)
0.014 \set tid random(1, 10 * :scale)
0.013 \set delta random(-5000, 5000)
0.572 BEGIN;
0.640 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
0.649 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
1.214 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
3.341 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
0.636 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
0.411 END;
边栏推荐
- Ocr-gan [anomaly detection: Reconstruction Based]
- Padim [anomaly detection: embedded based]
- 1e3是浮点数?
- Reading of "robust and communication efficient federated learning from non-i.i.d. data"
- 赋能中国芯创业者!看摩尔精英如何破解中小芯片企业发展难题
- Use FFT, matrix multiplication and conv2d to calculate convolution based on pytorch
- Xinhuazhang announced the completion of more than 200million a-round financing and the comprehensive layout of eda2.0 R & D
- Paper reading vision gnn: an image is worth graph of nodes
- Symbol符号类型
- Empowering Chinese core entrepreneurs! See how Moore elite solves the development problems of small and medium-sized chip Enterprises
猜你喜欢
![MKD [anomaly detection: knowledge disruption]](/img/15/10f5c8d6851e94dac764517c488dbc.png)
MKD [anomaly detection: knowledge disruption]
![Mspba [anomaly detection: representation_based]](/img/95/1f7390ec024a2865acb9e9a41100b1.png)
Mspba [anomaly detection: representation_based]

cannot resize variables that require grad

无代码开发平台管理后台入门教程

Yolov5 improvement 4: add ECA channel attention mechanism
![Labelme labels circular objects [tips]](/img/da/5790d814168b23321ab00a1d17189f.png)
Labelme labels circular objects [tips]

从 IPv4 向 IPv6 的迁移
![CFA [anomaly detection: embedded_based]](/img/ee/da822a7e8b443236338d4274b066c7.png)
CFA [anomaly detection: embedded_based]

Summary of the problem that MathType formula does not correspond in word

《Shortening passengers’ travel time A dynamic metro train scheduling approach using deep reinforcem》
随机推荐
Use the picture name to label the picture [tips]
es个人整理的相关面试题
Improvement 18 of yolov5: the loss function is improved to alpha IOU loss function
弹框遮罩层「建议收藏」
赋能中国芯创业者!看摩尔精英如何破解中小芯片企业发展难题
Learning experience sharing 5: yolov5 dataset division and Yolo format conversion
Console.log() console display... Solution
One of the experience of solving problems with code error reporting: CUDA does not match pytorch
Target detection notes fast r-cnn
The US FCC provided us $1.6 billion to support domestic operators to remove Huawei and ZTE equipment
PCA学习
Bluetooth smart Bracelet system based on STM32 MCU
Annaconda installs pytoch and switches environments
Wheel 6: qserialport serial port data transceiver
一种分布式深度学习编程新范式:Global Tensor
[3D target detection] 3dssd (I)
Yolov5 improvement 4: add ECA channel attention mechanism
[database]
Torch.fft.fft 2. () error reporting problem solution
【复制】互联网术语、简称、缩写