pgbench并发写入测试

最近更新时间: 2025-02-18 16:02:00

  • 复制
    复制成功
[tbase@VM_0_37_centos pgbench]$ cat select_t_trgm.sql
\set id random(1, 1000000)
select * from t_trgm where trgm ilike '%'||substring(md5(:id) from 3 for 6)||'%';
[tbase@VM_0_37_centos pgbench]$ pgbench -h 127.0.0.1 -p 11008 -d postgres -U tbase -c 4 -j 1 -n -M prepared -T 60 -r -f select_t_trgm.sql > select_t_trgm.txt 2>&1
[tbase@VM_0_37_centos pgbench]$ tail -20 select_t_trgm.txt
client 1 receiving
client 0 receiving
client 3 receiving
client 1 receiving
client 2 receiving
pghost: 127.0.0.1 pgport: 11008 nclients: 4 duration: 60 dbName: postgres
transaction type: select_t_trgm.sql
scaling factor: 1
query mode: prepared
number of clients: 4
number of threads: 1
duration: 60 s
number of transactions actually processed: 57280
latency average = 4.190 ms
tps = 954.570838 (including connections establishing)
tps = 954.650960 (excluding connections establishing)
script statistics:
 - statement latencies in milliseconds:
         0.011  \set id random(1, 1000000)
         4.177  select * from t_trgm where trgm ilike '%'||substring(md5(:id) from 3 for 6)||'%';