MySQL TPCH測試載入器簡要手冊

來源:互聯網
上載者:User

標籤:mysql faq   tpch   

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:  TPCHDATABASE= MYSQLMACHINE = LINUXWORKLOAD = 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編譯,編譯完畢後會產生兩個可執行檔:
dbgen:資料產生工具。在使用InfiniDB官方測試指令碼進行測試時,需要用該工具產生tpch相關表資料。
qgen:SQL產生工具
產生初始化測試資料:

#先把sql指令碼模板拷貝到dbgen所在目錄下[[email protected] tpch]# cp -f queries/*.sql ./[[email protected] tpch]# time ./dbgen -s 50TPC-H Population Generator (Version 2.9.0)Copyright Transaction Processing Performance Council 1994 - 2008real    192m43.897suser    37m45.398ssys     19m4.132s[[email protected] tpch]# ls -lh *tbl-rw-r--r-- 1 root root 1.2G Sep 21 15:23 customer.tbl-rw-r--r-- 1 root root 1.4G Sep 21 15:23 lineitem.tbl-rw-r--r-- 1 root root 2.2K Sep 21 15:23 nation.tbl-rw-r--r-- 1 root root 317M Sep 21 15:23 orders.tbl-rw-r--r-- 1 root root 504K Sep 21 15:23 partsupp.tbl-rw-r--r-- 1 root root 464K Sep 21 15:23 part.tbl-rw-r--r-- 1 root root  389 Sep 21 15:23 region.tbl-rw-r--r-- 1 root root  69M Sep 21 15:23 supplier.tbl

dbgen參數 -s 的作用是指定產生測試資料的倉庫數,建議基準值設定在100以上,在我的測試環境中,一般都設定為1000。
由於源碼包中內建的tpch初始化庫表指令碼並不能完全適用MySQL,需要修改部分代碼。
先產生測試SQL指令碼:

[[email protected] tpch]# ./qgen | sed -e ‘s/\r//‘ > queries/tpch_queries.sql

而後用vim開啟tpch_queries.sql指令碼,進行下面幾次全域替換:

:%s/;\nlimit/ limit/g:%s/limit -1/limit 1/g

搜尋所有類似下面的語句,去掉後面的 (3):

l_shipdate l_shipdate


--------------------------------------分割線--------------------------------------

知數堂 (http://zhishuedu.com)培訓是由資深MySQL專家葉金榮、吳炳錫聯合推出的專業優質培訓品牌,主要有MySQL DBA實戰最佳化和Python營運開發課程,是業內最有良心、最有品質的培訓課程。


本文出自 “老葉茶館” 部落格,請務必保留此出處http://imysql.blog.51cto.com/1540006/1879756

MySQL TPCH測試載入器簡要手冊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.