一、测试环境
名称 | 版本 |
---|---|
操作系统 | Red Hat Enterprise Linux Server release 7.9 (Maipo) |
CPU | Intel® Core™ i7-7700HQ CPU @ 2.80GHz |
内存 | 5G |
TPCH工具 | 2.14.0 |
二、TPCH工具下载地址
2、百度云盘链接
链接:https://pan.baidu.com/s/1VZHKCrk1JsKWLrpbeanbBg
提取码:y6sa
三、生成20G测试数据
unzip tpch_dbgen_linux64-2.14.0.zip
cd tpch_dbgen_linux64/
chmod 777 dbgen
[root@xdw0 tpch_dbgen_linux64]# ./dbgen -vf -s 20
TPC-H Population Generator (Version 2.14.0)
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.
[root@xdw0 tpch_dbgen_linux64]# ll
-rw-r--r--. 1 root root 1180 2月 27 2012 buildall
-rw-r--r--. 1 root root 490806602 5月 2 11:34 customer.tbl
-rwxrwxrwx. 1 root root 124297 2月 27 2012 dbgen
-rw-r--r--. 1 root root 11815 2月 27 2012 dists.dss
-rw-r--r--. 1 root root 15685400985 5月 2 11:34 lineitem.tbl
-rw-r--r--. 1 root root 2224 5月 2 11:34 nation.tbl
-rw-r--r--. 1 root root 3517488366 5月 2 11:34 orders.tbl
-r-sr-S--T. 1 root root 2422915386 5月 2 11:34 partsupp.tbl
-rw-r--r--. 1 root root 487760640 5月 2 11:34 part.tbl
-rw-r--r--. 1 root root 389 5月 2 11:34 region.tbl
-rw-r--r--. 1 root root 28471512 5月 2 11:34 supplier.tbl
[root@xdw0 tpch_dbgen_linux64]# du -sh ../
22G ../
生成的8个tbl文件修改为csv结尾,下面的例子都以lineitem表为例,其他表可以以此为参考。
mv lineitem.tbl lineitem.csv
四、SingleStore建表及管道
--1
CREATE TABLE LINEITEM
(L_ORDERKEY BIGINT NOT NULL,
L_PARTKEY INT NOT NULL,
L_SUPPKEY INT NOT NULL,
L_LINENUMBER INT NOT NULL,
L_QUANTITY FLOAT NOT NULL,
L_EXTENDEDPRICE FLOAT NOT NULL,
L_DISCOUNT FLOAT NOT NULL,
L_TAX FLOAT NOT NULL,
L_RETURNFLAG CHAR(1) NOT NULL,
L_LINESTATUS CHAR(1) NOT NULL,
L_SHIPDATE DATE NOT NULL,
L_COMMITDATE DATE NOT NULL,
L_RECEIPTDATE DATE NOT NULL,
L_SHIPINSTRUCT CHAR(25) NOT NULL,
L_SHIPMODE CHAR(10) NOT NULL,
L_COMMENT VARCHAR(44) NOT NULL,
key(L_ORDERKEY,L_LINENUMBER) using clustered columnstore);
--2
SET GLOBAL pipelines_stop_on_error = false;
--3
CREATE PIPELINE LINEITEM_PIP AS LOAD DATA FS '/home/test/tpch/lineitem.csv' INTO TABLE LINEITEM FIELDS TERMINATED BY '|' lines TERMINATED BY '|\n';
--4
START PIPELINE LINEITEM_PIP;
--5
SHOW PIPELINES;
+------------------+---------+-----------+
| Pipelines_in_czg | State | Scheduled |
+------------------+---------+-----------+
| LINEITEM_PIP | Running | False |
+------------------+---------+-----------+
1 row in set (0.00 sec)
--6
select count(*) from LINEITEM;
+-----------+
| count(*) |
+-----------+
| 119994608 |
+-----------+
1 row in set (0.00 sec)