Hologres vs Clickhouse性能對(duì)比參考測(cè)試
本文將為您介紹Hologres和Clickhouse在SSB單表數(shù)據(jù)集上進(jìn)行了性能對(duì)比測(cè)試的結(jié)果。
背景信息
Star schema benchmark(以下簡(jiǎn)稱SSB)是學(xué)術(shù)界和工業(yè)界廣泛使用的一個(gè)星型模型測(cè)試集,該測(cè)試集用于對(duì)比各種OLAP產(chǎn)品的基礎(chǔ)性能指標(biāo)。Clickhouse官方將SSB的星型模型打平轉(zhuǎn)化成寬表,改造成了一個(gè)單表測(cè)試集,詳情請(qǐng)參見(jiàn)Clickhouse官方鏈接。
本報(bào)告記錄了Hologres和Clickhouse在SSB單表數(shù)據(jù)集上進(jìn)行了性能對(duì)比測(cè)試的結(jié)果,測(cè)試結(jié)論如下。
在單表測(cè)試的13個(gè)查詢中,11個(gè)查詢Hologres比Clickhouse更快。
在單表測(cè)試場(chǎng)景中,13個(gè)查詢Clickhouse總耗時(shí)是Hologres的1.35倍。
測(cè)試環(huán)境介紹
為了消除網(wǎng)絡(luò)帶寬的影響,本測(cè)試使用同一臺(tái)ECS向Hologres和Clickhouse發(fā)送查詢請(qǐng)求且使用VPC連接,其中Hologres測(cè)試關(guān)閉了result cache。具體環(huán)境信息如下。
Clickhouse測(cè)試環(huán)境
配置項(xiàng)
詳情配置信息
機(jī)器
1臺(tái)阿里云ECS主機(jī)
CPU
Intel Xeon(Ice Lake) Platinum 8369B 64 vCore
內(nèi)存
256 GiB
內(nèi)網(wǎng)帶寬
32 Gbps
磁盤(pán)
ESSD高效云盤(pán)200 GB PL1 單盤(pán)IOPS上限5萬(wàn)
操作系統(tǒng)
CentOS 8.4 64位
硬件費(fèi)用(不含公網(wǎng)帶寬)
9,032 元/月
公網(wǎng)IPv4帶寬
200 Mbps
網(wǎng)絡(luò)費(fèi)用
15,725 元/月
Clickhouse版本
21.8.3.44
Hologres測(cè)試環(huán)境
配置項(xiàng)
具體配置信息
計(jì)算資源
CPU:64 Core,內(nèi)存:256 GB
存儲(chǔ)資源
200 GB(邏輯存儲(chǔ))
公網(wǎng)帶寬
大于5 Gbps
總費(fèi)用
11,080 元/月
Hologres版本
0.10.33
測(cè)試數(shù)據(jù)
表名 | 行數(shù) | 解釋 |
lineorder | 6億 | SSB商品訂單表 |
customer | 300萬(wàn) | SSB客戶表 |
part | 140萬(wàn) | SSB 零部件表 |
supplier | 20萬(wàn) | SSB 供應(yīng)商表 |
dates | 2556 | 日期表 |
lineorder_flat | 6億 | SSB打平后的寬表 |
相關(guān)SQL命令
Clickhouse命令
所使用的DDL與查詢SQL與Clickhouse官網(wǎng)測(cè)試方式一致,詳情請(qǐng)參見(jiàn)Clickhouse官方鏈接。
Hologres命令
DDL
DROP TABLE IF EXISTS lineorder_flat; BEGIN; CREATE TABLE IF NOT EXISTS lineorder_flat ( lo_orderdate date NOT NULL , lo_orderkey int NOT NULL , lo_linenumber int NOT NULL , lo_custkey int NOT NULL , lo_partkey int NOT NULL , lo_suppkey int NOT NULL , lo_orderpriority text NOT NULL , lo_shippriority int NOT NULL , lo_quantity int NOT NULL , lo_extendedprice int NOT NULL , lo_ordtotalprice int NOT NULL , lo_discount int NOT NULL , lo_revenue int NOT NULL , lo_supplycost int NOT NULL , lo_tax int NOT NULL , lo_commitdate date NOT NULL , lo_shipmode text NOT NULL , c_name text NOT NULL , c_address text NOT NULL , c_city text NOT NULL , c_nation text NOT NULL , c_region text NOT NULL , c_phone text NOT NULL , c_mktsegment text NOT NULL , s_region text NOT NULL , s_nation text NOT NULL , s_city text NOT NULL , s_name text NOT NULL , s_address text NOT NULL , s_phone text NOT NULL , p_name text NOT NULL , p_mfgr text NOT NULL , p_category text NOT NULL , p_brand text NOT NULL , p_color text NOT NULL , p_type text NOT NULL , p_size int NOT NULL , p_container text NOT NULL, PRIMARY KEY (lo_orderkey,lo_linenumber) ); CALL set_table_property('lineorder_flat', 'distribution_key', 'lo_orderkey'); CALL set_table_property('lineorder_flat', 'segment_key', 'lo_orderdate'); CALL set_table_property('lineorder_flat', 'clustering_key', 'lo_orderdate'); CALL set_table_property('lineorder_flat', 'bitmap_columns', 'p_category,s_region,c_region,c_nation,s_nation,c_city,s_city,p_mfgr,p_brand'); CALL set_table_property('lineorder_flat', 'time_to_live_in_seconds', '31536000'); COMMIT;
查詢SQL
Q1.1
SELECT SUM(LO_EXTENDEDPRICE * LO_DISCOUNT) AS REVENUE FROM LINEORDER_FLAT WHERE LO_ORDERDATE >= DATE '1993-01-01' AND LO_ORDERDATE <= DATE '1993-12-31' AND LO_DISCOUNT BETWEEN 1 AND 3 AND LO_QUANTITY < 25;
Q1.2
SELECT SUM(LO_EXTENDEDPRICE * LO_DISCOUNT) AS REVENUE FROM LINEORDER_FLAT WHERE LO_ORDERDATE >= DATE '1994-01-01' AND LO_ORDERDATE <= DATE '1994-01-31' AND LO_DISCOUNT BETWEEN 4 AND 6 AND LO_QUANTITY BETWEEN 26 AND 35;
Q1.3
SELECT SUM(LO_EXTENDEDPRICE * LO_DISCOUNT) AS REVENUE FROM LINEORDER_FLAT WHERE EXTRACT(WEEK FROM LO_ORDERDATE ) = 6 AND LO_ORDERDATE >= DATE '1994-01-01' AND LO_ORDERDATE <= DATE '1994-12-31' AND LO_DISCOUNT BETWEEN 5 AND 7 AND LO_QUANTITY BETWEEN 26 AND 35;
Q2.1
SELECT SUM(LO_REVENUE), EXTRACT(YEAR FROM LO_ORDERDATE) AS YEAR, P_BRAND FROM LINEORDER_FLAT WHERE P_CATEGORY = 'MFGR#12' AND S_REGION = 'AMERICA' GROUP BY YEAR, P_BRAND ORDER BY YEAR, P_BRAND;
Q2.2
SELECT SUM(LO_REVENUE), EXTRACT(YEAR FROM LO_ORDERDATE) AS YEAR, P_BRAND FROM LINEORDER_FLAT WHERE P_BRAND BETWEEN 'MFGR#2221' AND 'MFGR#2228' AND S_REGION = 'ASIA' GROUP BY YEAR, P_BRAND ORDER BY YEAR, P_BRAND;
Q2.3
SELECT SUM(LO_REVENUE), EXTRACT(YEAR FROM LO_ORDERDATE) AS YEAR, P_BRAND FROM LINEORDER_FLAT WHERE P_BRAND = 'MFGR#2239' AND S_REGION = 'EUROPE' GROUP BY YEAR, P_BRAND ORDER BY YEAR, P_BRAND;
Q3.1
SELECT C_NATION, S_NATION, EXTRACT(YEAR FROM LO_ORDERDATE) AS YEAR, SUM(LO_REVENUE) AS REVENUE FROM LINEORDER_FLAT WHERE C_REGION = 'ASIA' AND S_REGION = 'ASIA' AND LO_ORDERDATE >= DATE '1992-01-01' AND LO_ORDERDATE <= DATE '1997-12-31' GROUP BY C_NATION,S_NATION,YEAR ORDER BY YEAR ASC,REVENUE DESC;
Q3.2
SELECT C_CITY, S_CITY, EXTRACT(YEAR FROM LO_ORDERDATE) AS YEAR, SUM(LO_REVENUE) AS REVENUE FROM LINEORDER_FLAT WHERE C_NATION = 'UNITED STATES' AND S_NATION = 'UNITED STATES' AND LO_ORDERDATE >= DATE '1992-01-01' AND LO_ORDERDATE <= DATE '1997-12-31' GROUP BY C_CITY, S_CITY, YEAR ORDER BY YEAR ASC, REVENUE DESC;
Q3.3
SELECT C_CITY, S_CITY, EXTRACT(YEAR FROM LO_ORDERDATE) AS YEAR, SUM(LO_REVENUE) AS REVENUE FROM LINEORDER_FLAT WHERE C_CITY IN ( 'UNITED KI1' ,'UNITED KI5') AND S_CITY IN ( 'UNITED KI1' ,'UNITED KI5') AND LO_ORDERDATE >= DATE '1992-01-01' AND LO_ORDERDATE <= DATE '1997-12-31' GROUP BY C_CITY, S_CITY, YEAR ORDER BY YEAR ASC, REVENUE DESC;
Q3.4
SELECT C_CITY, S_CITY, EXTRACT(YEAR FROM LO_ORDERDATE) AS YEAR, SUM(LO_REVENUE) AS REVENUE FROM LINEORDER_FLAT WHERE C_CITY IN ('UNITED KI1', 'UNITED KI5') AND S_CITY IN ( 'UNITED KI1', 'UNITED KI5') AND LO_ORDERDATE >= DATE '1997-12-01' AND LO_ORDERDATE <= DATE '1997-12-31' GROUP BY C_CITY, S_CITY, YEAR ORDER BY YEAR ASC, REVENUE DESC;
Q4.1
SELECT EXTRACT(YEAR FROM LO_ORDERDATE) AS YEAR, C_NATION, SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT FROM LINEORDER_FLAT WHERE C_REGION = 'AMERICA' AND S_REGION = 'AMERICA' AND P_MFGR IN ( 'MFGR#1' , 'MFGR#2') GROUP BY YEAR, C_NATION ORDER BY YEAR ASC, C_NATION ASC;
Q4.2
SELECT EXTRACT(YEAR FROM LO_ORDERDATE) AS YEAR, S_NATION, P_CATEGORY, SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT FROM LINEORDER_FLAT WHERE C_REGION = 'AMERICA' AND S_REGION = 'AMERICA' AND LO_ORDERDATE >= DATE '1997-01-01' AND LO_ORDERDATE <= DATE '1998-12-31' AND P_MFGR IN ( 'MFGR#1' , 'MFGR#2') GROUP BY YEAR, S_NATION, P_CATEGORY ORDER BY YEAR ASC, S_NATION ASC, P_CATEGORY ASC;
Q4.3
SELECT EXTRACT(YEAR FROM LO_ORDERDATE) AS YEAR, S_CITY, P_BRAND, SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT FROM LINEORDER_FLAT WHERE S_NATION = 'UNITED STATES' AND LO_ORDERDATE >= DATE '1997-01-01' AND LO_ORDERDATE <= DATE '1998-12-31' AND P_CATEGORY = 'MFGR#14' GROUP BY YEAR, S_CITY, P_BRAND ORDER BY YEAR ASC, S_CITY ASC, P_BRAND ASC;
測(cè)試結(jié)果
SQL | Hologres用時(shí)(ms) | Clickhouse用時(shí)(ms) | Clickhouse/Hologres用時(shí) |
Q1.1 | 43.66 | 59.00 | 1.35 |
Q1.2 | 20.68 | 21.00 | 1.02 |
Q1.3 | 57.98 | 22.00 | 0.38 |
Q2.1 | 247.63 | 254.00 | 1.03 |
Q2.2 | 251.90 | 281.00 | 1.12 |
Q2.3 | 165.73 | 214.00 | 1.29 |
Q3.1 | 332.84 | 434.00 | 1.30 |
Q3.2 | 247.79 | 348.00 | 1.40 |
Q3.3 | 117.46 | 299.00 | 2.55 |
Q3.4 | 30.05 | 25.00 | 0.83 |
Q4.1 | 298.48 | 456.00 | 1.53 |
Q4.2 | 116.47 | 171.00 | 1.47 |
Q4.3 | 97.68 | 146.00 | 1.49 |
合計(jì) | 2,028.35 | 2,730.00 | 1.35 |