tpch是TPC(Transaction Processing Performance Council)组织提供的工具包。用于进行OLAP测试,以评估商业分析中决策支持系统(DSS)的性能。它包含了一整套面向商业的ad-hoc查询和并发数据修改,强调测试的是数据库、平台和I/O性能,关注查询能力。
官网:http://www.tpc.org/tpch
下载地址:http://www.tpc.org/tpch/spec/tpch_2_14_3.tgz 或 http://www.tpc.org/tpch/spec/tpch_2_14_3.zip
1、编译安装
下载源码包,解压缩,然后:
cp makefile.suite makefile
修改makefile文件中的CC、DATABASE、MACHINE、WORKLOAD等定义:
################
## CHANGE NAME OF ANSI COMPILER HERE
################
CC = gcc
# Current values for DATABASE are: INFORMIX, DB2, ORACLE,
# SQLSERVER, SYBASE, TDAT (Teradata)
# Current values for MACHINE are: ATT, DOS, HP, IBM, ICL, MVS,
# SGI, SUN, U2200, VMS, LINUX, WIN32
# Current values for WORKLOAD are: TPCH
DATABASE= MYSQL
MACHINE = LINUX
WORKLOAD = TPCH
修改tpcd.h文件,增加几行宏定义:
#ifdef MYSQL
#define GEN_QUERY_PLAN ""
#define START_TRAN "START TRANSACTION"
#define END_TRAN "COMMIT"
#define SET_OUTPUT ""
#define SET_ROWCOUNT "limit %d;\n"
#define SET_DBASE "use %s;\n"
#endif
然后执行make编译,编译完毕后会生成两个可执行文件:
"LOAD DATA INFILE 'path/dbgen/customer.tbl' INTO TABLE CUSTOMER FIELDS TERMINATED BY '|';"
myqsl -e "LOAD DATA INFILE 'path/dbgen/orders.tbl' INTO TABLE ORDERS FIELDS TERMINATED BY '|';"
myqsl -e "LOAD DATA INFILE 'path/dbgen/lineitem.tbl' INTO TABLE LINEITEM FIELDS TERMINATED BY '|';"
myqsl -e "LOAD DATA INFILE 'path/dbgen/nation.tbl' INTO TABLE NATION FIELDS TERMINATED BY '|';"
myqsl -e "LOAD DATA INFILE 'path/dbgen/partsupp.tbl' INTO TABLE PARTSUPP FIELDS TERMINATED BY '|';"
myqsl -e "LOAD DATA INFILE 'path/dbgen/part.tbl' INTO TABLE PART FIELDS TERMINATED BY '|';"
myqsl -e "LOAD DATA INFILE 'path/dbgen/region.tbl' INTO TABLE REGION FIELDS TERMINATED BY '|';"
myqsl -e "LOAD DATA INFILE 'path/dbgen/supplier.tbl' INTO TABLE SUPPLIER FIELDS TERMINATED BY '|';"
4、执行tpch测试
接下来就可以进行tpch测试了,逐个执行23个查询SQL脚本即可,每次执行前都要重启下MySQL实例,确保每次的内存缓冲区都是干净的。
简单循环测试脚本如下:
#!/bin/sh ## ## 执行tpch OLAP测试 ## ## writed by yejr(http://imysql.com), 2012/12/14 ## PATH=$PATH:/usr/local/bin export PATH . ~/.bash_profile > /dev/null 2>&1 exec 3>&1 4>&2 1 tpch-benchmark-olap-`date +'%Y%m%d%H%M%S'`.log 2>&1 I=1 II=3 while [ $I -le $II ] do N=1 T=23 while [ $N -lt $T ] do if [ $N -lt 10 ] ; then NN='0'$N else NN=$N fi echo "query $NN starting" /etc/init.d/mysql restart time mysql -f tpch < ./queries/tpch_${NN}.sql echo "query $NN ended!" N=`expr $N + 1` done I=`expr $I + 1` Done
附件:tpch初始化、自动化测试脚本压缩包与word手册。
MySQL-tpch,测试工具
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com