The official TPC-DS tools can be found at tpc.org.
This tpcds-kit is ported from gregrahn/tpcds-kit, thanks to gregrahn, this version is based on v2.7.0 and has been modified to:
- Allow compilation under macOS (commit 2ec45c5)
- Address obvious query template bugs like
Make sure the required development tools are installed:
- Ubuntu:
sudo apt-get install gcc make flex bison byacc git
- CentOS/RHEL:
sudo yum install gcc make flex bison byacc git
- MacOS:
xcode-select --install
- Linux:
cd tools && make OS=LINUX -j8 && cd -
- MacOS:
cd tools && make OS=MACOS -j8 && cd -
Data generation is done via dsdgen
:
# "-sc" is used to specify the volume of data to generate in GB.
cd tools && ./dsdgen -sc 1 -f && cd -
mysql -h 127.0.0.1 -P 4000 -u root -D test -e "drop database if exists tpcds;"
mysql -h 127.0.0.1 -P 4000 -u root -D test -e "create database tpcds;"
mysql -h 127.0.0.1 -P 4000 -u root -D tpcds < tools/tpcds.sql
rm -rf load_data.log
touch load_data.log
for file_name in `ls tools/*.dat`; do
table_file=$(echo "${file_name##*/}")
table_name=$(echo "${table_file%.*}" | tr '[:lower:]' '[:upper:]')
load_data_sql="LOAD DATA LOCAL INFILE '$file_name' INTO TABLE $table_name FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n';"
mysql -h 127.0.0.1 -P 4000 -u root --local-infile=1 -D tpcds -e "$load_data_sql" >> load_data.log 2>&1 &
done
Query generation is done via dsqgen
with query templetes, here we use a pre-written shell script file genquery.sh, after running this script, queries are located in directory "queries":
./genquery.sh
All supported TPC-DS queries for TiDB are generated in tools/queries
load_data.sh can be used to complete step 1~4, look into that file for more details.