赞
踩
git clone https://gitee.com/xzp-blog/tpch-kit.git
cd /opt/software/tpch-kit/dbgen/
make -f Makefile
gsql -d postgres -p 5432 -r
openGauss=# CREATE DATABASE tpch;
openGauss=# \q
cd /opt/software/tpch-kit/dbgen
gsql -d tpch -f dss.ddl
List of relations
Schema | Name | Type | Owner | Storage
--------+----------+-------+-------+----------------------------------
public | customer | table | omm | {orientation=row,compression=no}
public | lineitem | table | omm | {orientation=row,compression=no}
public | nation | table | omm | {orientation=row,compression=no}
public | orders | table | omm | {orientation=row,compression=no}
public | part | table | omm | {orientation=row,compression=no}
public | partsupp | table | omm | {orientation=row,compression=no}
public | region | table | omm | {orientation=row,compression=no}
public | supplier | table | omm | {orientation=row,compression=no}
cd /opt/software/tpch-kit/dbgen
./dbgen -vf -s 1
[omm@opengauss01 dbgen]$ ./dbgen -vf -s 1
TPC-H Population Generator (Version 2.17.3)
Copyright Transaction Processing Performance Council 1994 - 2010
Generating data for suppliers table/
Preloading text ... 100%
done.
Generating data for customers tabledone.
Generating data for orders/lineitem tablesdone.
Generating data for part/partsupplier tablesdone.
Generating data for nation tabledone.
Generating data for region tabledone.
for i in `ls *.tbl`; do
table=${i/.tbl/}
echo "Loading $table..."
sed 's/|$//' $i > /tmp/$i
gsql tpch -q -c "TRUNCATE $table"
gsql tpch -c "\\copy $table FROM '/tmp/$i' CSV DELIMITER '|'"
done
[omm@opengauss01 dbgen]$ chmod +x LoadData.sh
[omm@opengauss01 dbgen]$ sh LoadData.sh
Loading customer...
Loading lineitem...
Loading nation...
Loading orders...
Loading partsupp...
Loading part...
Loading region...
Loading supplier...
gsql -d tpch -p 5432 -r
tpch=# select count(*) from supplier;
tpch=# select count(*) from supplier;
count
-------
10000
(1 row)
tpch=# select count(*) from lineitem;
count
---------
6001215
(1 row)
tpch=# select count(*) from nation;
count
-------
25
(1 row)
tpch=# select count(*) from orders;
count
---------
1500000
(1 row)
tpch=# select count(*) from part;
count
--------
200000
(1 row)
tpch=# select count(*) from partsupp;
count
--------
800000
(1 row)
tpch=# select count(*) from region;
count
-------
5
(1 row)
tpch=#
cd /opt/software/tpch-kit/dbgen
cp dists.dss queries/
cp qgen queries/
cd queries/
cd /opt/software/tpch-kit/dbgen/queries
vim genda.sh
for i in {1..22}; do
./qgen -d $i>$i_new.sql
./qgen -d $i_new | sed 's/limit -1//' | sed 's/limit 100//' | sed 's/limit 10//' | sed 's/limit 20//' | sed 's/day (3)/day/' > queries.sql
done
cd /opt/software/tpch-kit/dbgen
sh genda.sh
cd /opt/software/tpch-kit/dbgen/queries
ls -l queries.sql
[omm@opengauss01 queries]$ ls -l queries.sql
-rw-r--r-- 1 omm dbgrp 12K Aug 29 23:49 queries.sql
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。