First, install the Tpc-ds tool
1. Download tool
Download Address: http://www.tpc.org/tpc_documents_current_versions/download_programs/tools-download-request.asp?bm_type= Tpc-ds&bm_vers=2.6.0&mode=current-only
Note: Must enter the mailbox, he will send the download address to the mailbox, click the download address to download.
2. Unzip the compilation tool
1) Unzip
Execute command: Unzip 944eb36c-5624-45ea-bece-646814a75b63-tpc-ds-tool.zip
2) Access to Tools directory compilation
Execute command: Make
The above TPC-DS test environment is ready.
Second. tables to be used to create TPC-DS tests
1. Be prepared to create a table statement
Tpc-ds is ready. CREATE table-related SQL files
The files are located under the Tools directory with the following specific files:
Tpcds.sql creating 25-sheet SQL statements
Tpcds_ri.sql SQL statement that creates a relationship between a table and a table
Tpcds_source.sql
2. Create the appropriate database and table using database connection tools (e.g. Navicat preminer)
Copy the prepared build statement into the tool create table
Third, generate the data and import the data into the appropriate table
1. Generate Data
To the Tools directory, execute the following command:
-dir Generating Data storage directory
-scale Generating Data size
1) Command 1:./dsdgen-dir/part2/tpcds/v2.6.0/datas/-scale 1 (scale indicates the generation of 1G test data)
2) command 2:./dsdgen-dir/part2/tpcds/v2.6.0/datas/-scale 10-parallel 4-child 1 (parallel generation of 1g data)
2, processing the generated data (not processed can not be imported into the table)-each line more than one "|"
Create a directory under the/part2/tpcds/v2.6.0/datas/directory handled
Command: MkDir handled
Execute the following command in the/part2/tpcds/v2.6.0/datas/directory:
For i in ' ls *.dat '
do
name= "handled/$i"
echo $name
' Touch $name '
chmod 777 $name '
sed ' s/|$// ' $i >> $name;
Done
3. Loading data into a table
Copy call_center from '/part2/tpcds/v2.6.0/datas/handled/call_center.dat ' with delimiter as ' | '
NULL '; Copy catalog_page from '/part2/tpcds/v2.6.0/datas/handled/catalog_page.dat ' with delimiter as ' | '
NULL '; Copy catalog_returns from '/part2/tpcds/v2.6.0/datas/handled/catalog_returns.dat ' with delimiter as ' | '
NULL '; Copy catalog_sales from '/part2/tpcds/v2.6.0/datas/handled/catalog_sales.dat ' with delimiter as ' | '
NULL '; Copy customer from '/part2/tpcds/v2.6.0/datas/handled/customer.dat ' with delimiter as ' | '
NULL '; Copy customer_address from '/part2/tpcds/v2.6.0/datas/handled/customer_address.dat ' with delimiter as ' | '
NULL '; Copy customer_demographics from '/part2/tpcds/v2.6.0/datas/handled/customer_demographics.dat ' with delimiter as ' | '
NULL '; Copy Date_dim from '/part2/tpcds/v2.6.0/datas/handled/date_dim.dat ' with delimiter as ' | '
NULL '; Copy dbgen_version from '/part2/tpcds/v2.6.0/datas/handled/dbgen_version.dat ' with delimiter as'|'
NULL '; Copy household_demographics from '/part2/tpcds/v2.6.0/datas/handled/household_demographics.dat ' with delimiter as ' | '
NULL '; Copy Income_band from '/part2/tpcds/v2.6.0/datas/handled/income_band.dat ' with delimiter as ' | '
NULL '; Copy inventory from '/part2/tpcds/v2.6.0/datas/handled/inventory.dat ' with delimiter as ' | '
NULL '; Copy item from '/part2/tpcds/v2.6.0/datas/handled/item.dat ' with delimiter as ' | '
NULL '; Copy promotion from '/part2/tpcds/v2.6.0/datas/handled/promotion.dat ' with delimiter as ' | '
NULL '; Copy reason from '/part2/tpcds/v2.6.0/datas/handled/reason.dat ' with delimiter as ' | '
NULL '; Copy ship_mode from '/part2/tpcds/v2.6.0/datas/handled/ship_mode.dat ' with delimiter as ' | '
NULL '; Copy store from '/part2/tpcds/v2.6.0/datas/handled/store.dat ' with delimiter as ' | '
NULL '; Copy store_returns from '/part2/tpcds/v2.6.0/datas/handled/store_returns.dat ' with delimiter as ' | '
NULL '; Copy store_sales from '/Part2/tpcds/v2.6.0/datas/handled/store_sales.dat ' with delimiter as ' | '
NULL '; Copy Time_dim from '/part2/tpcds/v2.6.0/datas/handled/time_dim.dat ' with delimiter as ' | '
NULL '; Copy warehouse from '/part2/tpcds/v2.6.0/datas/handled/warehouse.dat ' with delimiter as ' | '
NULL '; Copy web_page from '/part2/tpcds/v2.6.0/datas/handled/web_page.dat ' with delimiter as ' | '
NULL '; Copy web_returns from '/part2/tpcds/v2.6.0/datas/handled/web_returns.dat ' with delimiter as ' | '
NULL '; Copy web_sales from '/part2/tpcds/v2.6.0/datas/handled/web_sales.dat ' with delimiter as ' | '
NULL '; Copy web_site from '/part2/tpcds/v2.6.0/datas/handled/web_site.dat ' with delimiter as ' | ' NULL ';
Fourth. generating 99 query Statements
1, modify query_template under query1-99 template, at the end of the line and define _end = "", otherwise the execution of the command will be error;
1), write the shell script update_query.sh, and add the following:
#!/bin/bash
counter=1
while [$COUNTER-lt] do
echo $COUNTER
echo "define _end = \" \ ";" >>query$counter.tpl
counter= ' expr $COUNTER + 1 '
done
2), copy the update_query.sh to the Query_template directory, and execute the script
./update_query.sh
2, to the/part2/tpc-ds/v2.6.0/tools directory to execute the following command:
./dsqgen-output_dir/part2/tpcds/querydata/-input. /query_templates/templates.lst-scale 1-dialect oracle-directory. /query_templates
Note: Some database syntax for generated statements may not be supported, such as: PostgreSQL
Use the instructions in the continuous update ....