学习使用TPC-H测试达梦数据库流程

关于TPC-H

        TPCH是由TPC(Transaction Processing Performance Council)事务处理性能委员会公布的一套针对数据库决策支持能力的测试基准,通过模拟数据库中与业务相关的复杂查询考察数据库的综合处理能力,获取数据库操作的响应时间。

        TPCH基准模型中定义了一个数据库模型,容量可以在1GB~10000GB的8个级别中进行选择。数据库模型包括CUSTOMER、LINEITEM、NATION、ORDERS、PART、PARTSUPP、REGION和SUPPLIER 共8张数据表,以及22条SQL查询语句,涉及内容广泛丰富,可以较完整地测试数据库的运算性能。

测试环境

        达梦8,centos7.9

[root@localhost toolsql]# free -m
              total        used        free      shared  buff/cache   available
Mem:           7802        2712        4282          12         807        4843
Swap:          8064           0        8064
[root@localhost toolsql]# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 78
model name      : Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
stepping        : 3
microcode       : 0xd6
cpu MHz         : 2496.004
cache size      : 3072 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 arat md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities
bogomips        : 4992.00
clflush size    : 64
cache_alignment : 64
address sizes   : 45 bits physical, 48 bits virtual
power management:

[root@localhost toolsql]# df -h
文件系统        容量  已用  可用 已用% 挂载点
devtmpfs        3.8G     0  3.8G    0% /dev
tmpfs           3.9G     0  3.9G    0% /dev/shm
tmpfs           3.9G   13M  3.8G    1% /run
tmpfs           3.9G     0  3.9G    0% /sys/fs/cgroup
/dev/sda3       112G   25G   88G   22% /
/dev/sda1       297M  213M   85M   72% /boot
tmpfs           781M     0  781M    0% /run/user/1001

测试流程

1.使用dbgen生成数据

./dbgen -s 1 ##表示生成了1G数据

2.在数据库中建表

使用disql跑建表脚本

其中建表脚本如下:

drop table customer;        
drop table lineitem;        
drop table nation;        
drop table orders;        
drop table part;        
drop table partsupp;        
drop table region;        
drop table supplier;        
        
create huge table CUSTOMER        
(        
C_CUSTKEY                 int not null,                
C_NAME                    varchar(25) not null,    
C_ADDRESS                 varchar(40) not null,     
C_NATIONKEY               int not null,              
C_PHONE                   char(15) not null,        
C_ACCTBAL                 float not null,    
C_MKTSEGMENT             char(10) not null,        
C_COMMENT                 varchar(117) not null,    
primary key (C_CUSTKEY)        
);        
        
create huge table LINEITEM        
(        
L_ORDERKEY               int not null,       
L_PARTKEY                int not null,     
L_SUPPKEY                int not null,    
L_LINENUMBER             int not null,    
L_QUANTITY               float not null,    
L_EXTENDEDPRICE          float not null,    
L_DISCOUNT               float not null,    
L_TAX                    float not null,    
L_RETURNFLAG             char(1) not null,    
L_LINESTATUS             char(1) not null,     
L_SHIPDATE               date not null,    
L_COMMITDATE             date not null,    
L_RECEIPTDATE            date not null,    
L_SHIPINSTRUCT           char(25) not null,    
L_SHIPMODE               char(10) not null,     
L_COMMENT                varchar(44) not null,    
primary key(L_ORDERKEY , L_LINENUMBER)        
);        
        
create huge table NATION        
(        
N_NATIONKEY              int not null,             
N_NAME                   char(25) not null,        
N_REGIONKEY              int not null,             
N_COMMENT                varchar(152) not null,    
primary key (N_NATIONKEY)        
);        
        
create huge table ORDERS        
(        
O_ORDERKEY               int not null,     
O_CUSTKEY                int not null,    
O_ORDERSTATUS            char(1) not null,     
O_TOTALPRICE             float not null,    
O_ORDERDATE              date not null,    
O_ORDERPRIORITY          char(15) not null,    
O_CLERK                  char(15) not null,    
O_SHIPPRIORITY           integer not null,    
O_COMMENT                varchar(79) not null,    
primary key(O_ORDERKEY)        
);        
        
create huge table part        
(        
P_PARTKEY        int not null,
P_NAME                    varchar(55) not null,    
P_MFGR                    char(25) not null,    
P_BRAND                   char(10) not null,    
P_TYPE                    varchar(25) not null,    
P_SIZE                    int not null,    
P_CONTAINER               char(10) not null,    
P_RETAILPRICE             float not null,    
P_COMMENT                 varchar(23) not null,    
primary key (P_PARTKEY)        
);        
        
create huge table PARTSUPP        
(        
PS_PARTKEY                int not null,                    
PS_SUPPKEY                int not null,                    
PS_AVAILQTY               int not null,                    
PS_SUPPLYCOST             float not null,    
PS_COMMENT                varchar(199) not null,    
 primary key (PS_PARTKEY , PS_SUPPKEY)        
);        
        
create huge table REGION        
(        
R_REGIONKEY              int not null,               
R_NAME                   char(25) not null,          
R_COMMENT                varchar(152) not null,     
primary key (R_REGIONKEY)        
);        
        
create huge table SUPPLIER        
(        
S_SUPPKEY                 int not null,                   
S_NAME                    char(25) not null,             
S_ADDRESS                 varchar(40) not null,          
S_NATIONKEY               int not null,                   
S_PHONE                   char(15) not null,             
S_ACCTBAL                 float not null,    
S_COMMENT                 varchar(101) not null,        
primary key (S_SUPPKEY)        
);        
 

3.使用dmfldr加载数据

在前面的步骤中我们使用dbgen生成了8个表的数据,现在我们需要把八个表全部导入到数据库中。

以其中一个表为例:

./dmfldr SYSDBA/SYSDBA@localhost:5236 control=\’/dm8/crtl1/lineitem.ctrl\’ mode=\’IN\’

 4.查询验证

跑TPCH脚本Q22查询数据。

以下是Q20到Q22的执行结果:

至此已经完成了测试。

更多参考内容请访问达梦云适配中心

https://eco.dameng.com/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值