自研分区表

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

  • 复制
    复制成功
#创建测试表2048个子表 
create table t_time_range
(
  f1 bigint not null, f2 timestamp ,f3 bigint
) 
partition by range (f2) begin (timestamp without time zone '2017-09-01 0:0:0') 
step (interval '1 month') 
partitions (2048) distribute by shard(f1) 
to group default_group;

#pgbench sql脚本

[tbase@eg-9-117-182-250 pgbench]$ cat  insert_t_time_range.sql
\set f1 random(1, 10000000)
\set f2 random(1, 50000)
insert into t_time_range values(:f1,('2017-09-01'::date+:f2::integer)::timestamp,:f1);

#测试方法

[tbase@eg-9-117-182-250 pgbench]$  pgbench -h 9.117.183.12 -p 15432 -d pgbench -U tbase -c 64 -j 1 -n -M prepared -T 60 -r -f insert_t_time_range.sql > insert_t_time_range.log 2>&1 
#测试结果 
scaling factor: 1
query mode: prepared
number of clients: 64
number of threads: 1
duration: 60 s
number of transactions actually processed: 1039672
latency average = 3.695 ms
tps = 17319.573296 (including connections establishing)
tps = 17320.178973 (excluding connections establishing)
script statistics:
 - statement latencies in milliseconds:
         0.007  \set f1 random(1, 10000000)
         0.004  \set f2 random(1, 50000)
         3.673  insert into t_time_range values(:f1,('2017-09-01'::date+:f2::integer)::timestamp,:f1);