华为云用户手册

  • 配置监听 表4 SLB监听配置config字段说明 参数名 是否必选 说明 proxyReadTimeout 否 响应超时时间,不超过10位的数字。 proxySendTimeout 否 转发超时时间,不超过10位的数字。 keepaliveSwitch 否 启用长连接转发,是否keepalive,取值为on或off。 hostSwitch 否 是否透传请求头,取值为on或off,不填或者其他字符均为off。 xForwardedForSwitch 否 是否追加XFF,取值为on或off。 accessLogSwitch 否 是否开启access日志,取值为on或off,不填或者其他字符均为off。 proxyNextUpstreamSwitch 否 是否在异常时尝试下一台,取值为on或off,不填或者其他字符均为off。 proxyNextUpstreamCondition 否 尝试下一台场景,"403"、"404"、"429"、"500"、"502"、"503"、"504"、"error"、"timeout"、"invalid_header"。 clientConnectionFreeTime 否 客户端连接空闲时间,长度不超过10位的正整数。 proxyBuffersSwitch 否 开启响应缓存,取值为on或off,不填或者其他字符均为off。 proxyBuffersSize 否 响应缓存大小,由数字+空格+k/m组成,默认为8 k。 expiresSwitch 否 高级配置中Expires开关,取值为on或off,不填或者其他字符均为off。 expiresSize 否 设定页面缓存时间,不超过50位,不缓存或一直使用缓存。可以由字母、数字、空格、$、@、+、-、冒号、逗号组成。 indexPage 否 静态页面场景index页面设置,长度不超过255,非中文。 returnVal 否 固定返回响应码,长度不超过255,非中文。 allowMethod 否 允许的http方法,对于转发策略有效,对于监听仅为参考,在界面新增转发策略时会继承监听的此项配置,其余场景无效,"GET", "HEAD", "POST", "DELETE", "PUT", "OPTIONS", "PATCH", "MKCOL", "COPY", "MOVE", "PROPFIND", "PROPPATCH", "LOCK", "UNLOCK"。 command 否 nginx配置命令,非中文。 root 否 默认资源根目录,长度不超过500,非中文。 clientMaxBodySize 否 最大请求体大小,数字+空格+k/m组成。 clientBodyBufferSize 否 请求体buffer大小,数字+空格+k/m组成。 addHeaders 否 响应头 setVals 否 对应页面set proxySetHeaders 否 请求头 redirects 否 重定向 rewrites 否 重写 表5 addHeaders/setVals/proxySetHeaders字段说明 参数名 是否必选 说明 key 否 键,非中文 value 否 值,非中文 表6 redirects/rewrites字段字段活命 参数名 是否必选 说明 source 否 匹配规则,非中文。 target 否 重写/重定向目标,非中文。 option 否 重写标记,取值为:"last"、"break"、"permanent"。 slb_listener_config/listener_monitor_config.yaml hostSwitch: 'on' #是否透传请求头,on/off,不填或者其他字符均为off root: #默认资源根目录,不超过500非中文 clientConnectionFreeTime: 100 #客户端连接空闲时间,不超过10位的正整数 proxyReadTimeout: 70 #响应超时时间,不超过10位的数字 keepaliveSwitch: 'on' #启用长连接转发是否keepalive,on/off proxyBuffersSize: '2 m' #响应缓存大小,数字+空格+k/m组成,默认为8 k expiresSwitch: 'on' #高级配置中Expires开关,on/off,不填或者其他字符均为off proxyBuffersSwitch: 'on' #开启响应缓存,on/off,不填或者其他字符均为off accessLogSwitch: 'on' #是否开启access日志,on/off,不填或者其他字符均为off returnVal: 200 #固定返回响应码,不超过255非中文 allowMethod: POST,GET,HEAD,PUT,DELETE,OPTIONS #允许的http方法 nuwaTraceSwitch: 'off' command: #nginx配置命令,非中文 clientMaxBodySize: #最大请求体大小,数字+空格+k/m组成 clientBodyBufferSize: 10 #请求体buffer大小,数字+空格+k/m组成 expiresSize: 10 #设定页面缓存时间 indexPage: #静态页面场景index页面设置,不超过255非中文 proxyNextUpstreamCondition: error,timeout #尝试下一台场景 proxySendTimeout: 80 #转发超时时间,不超过10位的数字 xForwardedForSwitch: 'on' #是否追加XFF,on/off proxyNextUpstreamSwitch: 'on' #是否在异常时尝试下一台,on/off,不填或者其他字符均为off addHeaders: #响应头 - value: v1 key: k1 - value: v2 key: k2 rewrites: #重写 - source: s7 option: break target: t1 setVals: #对应页面set - value: v3 key: $k3 proxySetHeaders: #请求头 - value: v5 key: k5 redirects: #重定向 - source: s1 target: t1
  • Q2.1 1 2 3 4 5 6 7 SELECT SUM(LO_REVENUE), div(LO_ORDERDATE,10000) 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;
  • Q4.1 1 2 3 4 5 6 7 8 9 10 SELECT div(LO_ORDERDATE,10000) 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;
  • Q2.3 1 2 3 4 5 6 7 8 9 SELECT SUM(LO_REVENUE), div(LO_ORDERDATE,10000) 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;
  • 导入SSB数据 执行以下命令导入数据。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 INSERT INTO customer SELECT * FROM customer_load; INSERT INTO supplier SELECT * FROM supplier_load; INSERT INTO part SELECT * FROM part_load; INSERT INTO lineorder SELECT * FROM lineorder_load; INSERT INTO lineorder_flat SELECT l.LO_ORDERKEY AS LO_ORDERKEY, l.LO_LINENUMBER AS LO_LINENUMBER, l.LO_CUSTKEY AS LO_CUSTKEY, l.LO_PARTKEY AS LO_PARTKEY, l.LO_SUPPKEY AS LO_SUPPKEY, l.LO_ORDERDATE AS LO_ORDERDATE, l.LO_ORDERPRIORITY AS LO_ORDERPRIORITY, l.LO_SHIPPRIORITY AS LO_SHIPPRIORITY, l.LO_QUANTITY AS LO_QUANTITY, l.LO_EXTENDEDPRICE AS LO_EXTENDEDPRICE, l.LO_ORDTOTALPRICE AS LO_ORDTOTALPRICE, l.LO_DISCOUNT AS LO_DISCOUNT, l.LO_REVENUE AS LO_REVENUE, l.LO_SUPPLYCOST AS LO_SUPPLYCOST, l.LO_TAX AS LO_TAX, l.LO_COMMITDATE AS LO_COMMITDATE, l.LO_SHIPMODE AS LO_SHIPMODE, c.C_NAME AS C_NAME, c.C_ADDRESS AS C_ADDRESS, c.C_CITY AS C_CITY, c.C_NATION AS C_NATION, c.C_REGION AS C_REGION, c.C_PHONE AS C_PHONE, c.C_MKTSEGMENT AS C_MKTSEGMENT, s.S_NAME AS S_NAME, s.S_ADDRESS AS S_ADDRESS, s.S_CITY AS S_CITY, s.S_NATION AS S_NATION, s.S_REGION AS S_REGION, s.S_PHONE AS S_PHONE, p.P_NAME AS P_NAME, p.P_MFGR AS P_MFGR, p.P_CATEGORY AS P_CATEGORY, p.P_BRAND AS P_BRAND, p.P_COLOR AS P_COLOR, p.P_TYPE AS P_TYPE, p.P_SIZE AS P_SIZE, p.P_CONTAINER AS P_CONTAINER FROM lineorder AS l INNER JOIN customer AS c ON c.C_CUSTKEY = l.LO_CUSTKEY INNER JOIN supplier AS s ON s.S_SUPPKEY = l.LO_SUPPKEY INNER JOIN part AS p ON p.P_PARTKEY = l.LO_PARTKEY;
  • 创建SSB数据集的GDS外表 连接DWS数据库后执行以下SQL语句。 以下每个外表的“gsfs://192.168.0.90:500x/xxx | gsfs://192.168.0.90:500x/xxx”中的IP地址和端口,请替换成安装和启动GDS中的对应的GDS的监听IP和端口。如启动两个GDS,则使用“|”区分。如果启动多个GDS,需要将所有GDS的监听IP和端口配置到外表中。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 DROP FOREIGN TABLE IF EXISTS customer_load; CREATE FOREIGN TABLE customer_load ( C_CUSTKEY BIGINT NOT NULL , C_NAME VARCHAR(25) NOT NULL , C_ADDRESS VARCHAR(40) NOT NULL , C_CITY VARCHAR(25) NOT NULL , C_NATION VARCHAR(25) NOT NULL , C_REGION VARCHAR(25) NOT NULL , C_PHONE VARCHAR(15) NOT NULL , C_MKTSEGMENT VARCHAR(10) NOT NULL) SERVER gsmpp_server OPTIONS(location 'gsfs://192.168.0.90:5004/customer.tbl*', format 'text', delimiter '|', encoding 'utf8', mode 'Normal' ); DROP FOREIGN TABLE IF EXISTS supplier_load; CREATE FOREIGN TABLE supplier_load ( S_SUPPKEY BIGINT NOT NULL , S_NAME VARCHAR(25) NOT NULL , S_ADDRESS VARCHAR(40) NOT NULL , S_CITY VARCHAR(25) NOT NULL , S_NATION VARCHAR(25) NOT NULL , S_REGION VARCHAR(25) NOT NULL , S_PHONE VARCHAR(15) NOT NULL) SERVER gsmpp_server OPTIONS(location 'gsfs://192.168.0.90:5004/supplier.tbl*', format 'text', delimiter '|', encoding 'utf8', mode 'Normal' ); DROP FOREIGN TABLE IF EXISTS part_load; CREATE FOREIGN TABLE part_load ( P_PARTKEY BIGINT NOT NULL , P_NAME VARCHAR(55) NOT NULL , P_MFGR VARCHAR(25) NOT NULL , P_CATEGORY VARCHAR(25) NOT NULL , P_BRAND VARCHAR(10) NOT NULL , P_COLOR VARCHAR(20) NOT NULL , P_TYPE VARCHAR(25) NOT NULL , P_SIZE BIGINT NOT NULL , P_CONTAINER VARCHAR(10) NOT NULL) SERVER gsmpp_server OPTIONS(location 'gsfs://192.168.0.90:5004/part.tbl*', format 'text', delimiter '|', encoding 'utf8', mode 'Normal' ); DROP FOREIGN TABLE IF EXISTS lineorder_load; CREATE FOREIGN TABLE lineorder_load ( LO_ORDERKEY BIGINT NOT NULL, LO_LINENUMBER BIGINT NOT NULL, LO_CUSTKEY BIGINT NOT NULL, LO_PARTKEY BIGINT NOT NULL, LO_SUPPKEY BIGINT NOT NULL, LO_ORDERDATE DATE NOT NULL, LO_ORDERPRIORITY VARCHAR(15) NOT NULL, LO_SHIPPRIORITY BIGINT NOT NULL, LO_QUANTITY BIGINT NOT NULL, LO_EXTENDEDPRICE BIGINT NOT NULL, LO_ORDTOTALPRICE BIGINT NOT NULL, LO_DISCOUNT BIGINT NOT NULL, LO_REVENUE BIGINT NOT NULL, LO_SUPPLYCOST BIGINT NOT NULL, LO_TAX BIGINT NOT NULL, LO_COMMITDATE DATE NOT NULL, LO_SHIPMODE VARCHAR(10) NOT NULL) SERVER gsmpp_server OPTIONS(location 'gsfs://192.168.0.90:5004/lineorder.tbl*', format 'text', delimiter '|', encoding 'utf8', mode 'Normal' );
  • 创建SSB目标表 连接DWS数据库后执行以下SQL语句。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 CREATE TABLE CUSTOMER ( C_CUSTKEY BIGINT NOT NULL, C_NAME VARCHAR(25) NOT NULL, C_ADDRESS VARCHAR(40) NOT NULL, C_CITY VARCHAR(25) NOT NULL, C_NATION VARCHAR(25) NOT NULL, C_REGION VARCHAR(25) NOT NULL, C_PHONE VARCHAR(15) NOT NULL, C_MKTSEGMENT VARCHAR(10) NOT NULL ) WITH (orientation=column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash(C_CUSTKEY) ; CREATE TABLE SUPPLIER ( S_SUPPKEY BIGINT NOT NULL , S_NAME VARCHAR(25) NOT NULL , S_ADDRESS VARCHAR(40) NOT NULL , S_CITY VARCHAR(25) NOT NULL , S_NATION VARCHAR(25) NOT NULL , S_REGION VARCHAR(25) NOT NULL , S_PHONE VARCHAR(15) NOT NULL ) WITH (orientation=column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash(S_SUPPKEY); CREATE TABLE PART ( P_PARTKEY BIGINT NOT NULL , P_NAME VARCHAR(55) NOT NULL , P_MFGR VARCHAR(25) NOT NULL , P_CATEGORY VARCHAR(25) NOT NULL , P_BRAND VARCHAR(10) NOT NULL , P_COLOR VARCHAR(20) NOT NULL , P_TYPE VARCHAR(25) NOT NULL , P_SIZE BIGINT NOT NULL , P_CONTAINER VARCHAR(10) NOT NULL ) WITH (orientation=column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash(P_PARTKEY); CREATE TABLE lineorder ( LO_ORDERKEY BIGINT NOT NULL, LO_LINENUMBER BIGINT NOT NULL, LO_CUSTKEY BIGINT NOT NULL, LO_PARTKEY BIGINT NOT NULL, LO_SUPPKEY BIGINT NOT NULL, LO_ORDERDATE DATE NOT NULL, LO_ORDERPRIORITY VARCHAR(15) NOT NULL, LO_SHIPPRIORITY BIGINT NOT NULL, LO_QUANTITY BIGINT NOT NULL, LO_EXTENDEDPRICE BIGINT NOT NULL, LO_ORDTOTALPRICE BIGINT NOT NULL, LO_DISCOUNT BIGINT NOT NULL, LO_REVENUE BIGINT NOT NULL, LO_SUPPLYCOST BIGINT NOT NULL, LO_TAX BIGINT NOT NULL, LO_COMMITDATE DATE NOT NULL, LO_SHIPMODE VARCHAR(10) NOT NULL ) WITH (orientation=column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash(LO_ORDERKEY) PARTITION BY RANGE(LO_ORDERDATE) ( PARTITION LO_ORDERDATE_1 VALUES LESS THAN('1992-04-01 00:00:00'), PARTITION LO_ORDERDATE_2 VALUES LESS THAN('1992-07-01 00:00:00'), PARTITION LO_ORDERDATE_3 VALUES LESS THAN('1992-10-01 00:00:00'), PARTITION LO_ORDERDATE_4 VALUES LESS THAN('1993-01-01 00:00:00'), PARTITION LO_ORDERDATE_5 VALUES LESS THAN('1993-04-01 00:00:00'), PARTITION LO_ORDERDATE_6 VALUES LESS THAN('1993-07-01 00:00:00'), PARTITION LO_ORDERDATE_7 VALUES LESS THAN('1993-10-01 00:00:00'), PARTITION LO_ORDERDATE_8 VALUES LESS THAN('1994-01-01 00:00:00'), PARTITION LO_ORDERDATE_9 VALUES LESS THAN('1994-04-01 00:00:00'), PARTITION LO_ORDERDATE_10 VALUES LESS THAN('1994-07-01 00:00:00'), PARTITION LO_ORDERDATE_11 VALUES LESS THAN('1994-10-01 00:00:00'), PARTITION LO_ORDERDATE_12 VALUES LESS THAN('1995-01-01 00:00:00'), PARTITION LO_ORDERDATE_13 VALUES LESS THAN('1995-04-01 00:00:00'), PARTITION LO_ORDERDATE_14 VALUES LESS THAN('1995-07-01 00:00:00'), PARTITION LO_ORDERDATE_15 VALUES LESS THAN('1995-10-01 00:00:00'), PARTITION LO_ORDERDATE_16 VALUES LESS THAN('1996-01-01 00:00:00'), PARTITION LO_ORDERDATE_17 VALUES LESS THAN('1996-04-01 00:00:00'), PARTITION LO_ORDERDATE_18 VALUES LESS THAN('1996-07-01 00:00:00'), PARTITION LO_ORDERDATE_19 VALUES LESS THAN('1996-10-01 00:00:00'), PARTITION LO_ORDERDATE_20 VALUES LESS THAN('1997-01-01 00:00:00'), PARTITION LO_ORDERDATE_21 VALUES LESS THAN('1997-04-01 00:00:00'), PARTITION LO_ORDERDATE_22 VALUES LESS THAN('1997-07-01 00:00:00'), PARTITION LO_ORDERDATE_23 VALUES LESS THAN('1997-10-01 00:00:00'), PARTITION LO_ORDERDATE_24 VALUES LESS THAN('1998-01-01 00:00:00'), PARTITION LO_ORDERDATE_25 VALUES LESS THAN('1998-04-01 00:00:00'), PARTITION LO_ORDERDATE_26 VALUES LESS THAN('1998-07-01 00:00:00'), PARTITION LO_ORDERDATE_27 VALUES LESS THAN('1998-10-01 00:00:00'), PARTITION LO_ORDERDATE_28 VALUES LESS THAN('1999-01-01 00:00:00') ); SET enable_hstoreopt_auto_bitmap=true; CREATE TABLE lineorder_flat ( LO_ORDERKEY BIGINT NOT NULL, LO_LINENUMBER BIGINT NOT NULL, LO_CUSTKEY BIGINT NOT NULL, LO_PARTKEY BIGINT NOT NULL, LO_SUPPKEY BIGINT NOT NULL, LO_ORDERDATE DATE NOT NULL, LO_ORDERPRIORITY VARCHAR(15) NOT NULL, LO_SHIPPRIORITY BIGINT NOT NULL, LO_QUANTITY BIGINT NOT NULL, LO_EXTENDEDPRICE BIGINT NOT NULL, LO_ORDTOTALPRICE BIGINT NOT NULL, LO_DISCOUNT BIGINT NOT NULL, LO_REVENUE BIGINT NOT NULL, LO_SUPPLYCOST BIGINT NOT NULL, LO_TAX BIGINT NOT NULL, LO_COMMITDATE DATE NOT NULL, LO_SHIPMODE VARCHAR(10) NOT NULL, C_NAME VARCHAR(25) NOT NULL , C_ADDRESS VARCHAR(40) NOT NULL , C_CITY VARCHAR(25) NOT NULL , C_NATION VARCHAR(25) NOT NULL , C_REGION VARCHAR(25) NOT NULL , C_PHONE VARCHAR(15) NOT NULL , C_MKTSEGMENT VARCHAR(10) NOT NULL , S_NAME VARCHAR(25) NOT NULL , S_ADDRESS VARCHAR(40) NOT NULL , S_CITY VARCHAR(25) NOT NULL , S_NATION VARCHAR(25) NOT NULL , S_REGION VARCHAR(25) NOT NULL , S_PHONE VARCHAR(15) NOT NULL , P_NAME VARCHAR(55) NOT NULL , P_MFGR VARCHAR(25) NOT NULL , P_CATEGORY VARCHAR(25) NOT NULL , P_BRAND VARCHAR(10) NOT NULL , P_COLOR VARCHAR(20) NOT NULL , P_TYPE VARCHAR(25) NOT NULL , P_SIZE BIGINT NOT NULL , P_CONTAINER VARCHAR(10) NOT NULL , Partial Cluster Key(s_region,s_nation,s_city) ) WITH (orientation=column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true,secondary_part_column='p_mfgr', secondary_part_num=8) DISTRIBUTE BY hash(LO_ORDERKEY) PARTITION BY RANGE(LO_ORDERDATE) ( PARTITION LO_ORDERDATE_1 VALUES LESS THAN('1992-04-01 00:00:00'), PARTITION LO_ORDERDATE_2 VALUES LESS THAN('1992-07-01 00:00:00'), PARTITION LO_ORDERDATE_3 VALUES LESS THAN('1992-10-01 00:00:00'), PARTITION LO_ORDERDATE_4 VALUES LESS THAN('1993-01-01 00:00:00'), PARTITION LO_ORDERDATE_5 VALUES LESS THAN('1993-04-01 00:00:00'), PARTITION LO_ORDERDATE_6 VALUES LESS THAN('1993-07-01 00:00:00'), PARTITION LO_ORDERDATE_7 VALUES LESS THAN('1993-10-01 00:00:00'), PARTITION LO_ORDERDATE_8 VALUES LESS THAN('1994-01-01 00:00:00'), PARTITION LO_ORDERDATE_9 VALUES LESS THAN('1994-04-01 00:00:00'), PARTITION LO_ORDERDATE_10 VALUES LESS THAN('1994-07-01 00:00:00'), PARTITION LO_ORDERDATE_11 VALUES LESS THAN('1994-10-01 00:00:00'), PARTITION LO_ORDERDATE_12 VALUES LESS THAN('1995-01-01 00:00:00'), PARTITION LO_ORDERDATE_13 VALUES LESS THAN('1995-04-01 00:00:00'), PARTITION LO_ORDERDATE_14 VALUES LESS THAN('1995-07-01 00:00:00'), PARTITION LO_ORDERDATE_15 VALUES LESS THAN('1995-10-01 00:00:00'), PARTITION LO_ORDERDATE_16 VALUES LESS THAN('1996-01-01 00:00:00'), PARTITION LO_ORDERDATE_17 VALUES LESS THAN('1996-04-01 00:00:00'), PARTITION LO_ORDERDATE_18 VALUES LESS THAN('1996-07-01 00:00:00'), PARTITION LO_ORDERDATE_19 VALUES LESS THAN('1996-10-01 00:00:00'), PARTITION LO_ORDERDATE_20 VALUES LESS THAN('1997-01-01 00:00:00'), PARTITION LO_ORDERDATE_21 VALUES LESS THAN('1997-04-01 00:00:00'), PARTITION LO_ORDERDATE_22 VALUES LESS THAN('1997-07-01 00:00:00'), PARTITION LO_ORDERDATE_23 VALUES LESS THAN('1997-10-01 00:00:00'), PARTITION LO_ORDERDATE_24 VALUES LESS THAN('1998-01-01 00:00:00'), PARTITION LO_ORDERDATE_25 VALUES LESS THAN('1998-04-01 00:00:00'), PARTITION LO_ORDERDATE_26 VALUES LESS THAN('1998-07-01 00:00:00'), PARTITION LO_ORDERDATE_27 VALUES LESS THAN('1998-10-01 00:00:00'), PARTITION LO_ORDERDATE_28 VALUES LESS THAN('1999-01-01 00:00:00') ) ; SET enable_hstoreopt_auto_bitmap=false;
  • SSB数据生成 下载ssb工具包并编译。 git clone http://github.com/vadimtk/ssb-dbgen.git cd ssb-dbgen && make 生成数据。 文件生成路径最好符合安装和启动GDS中SSB所使用的路径,否则需要修改安装和启动GDS中GDS的启动路径。 ./dbgen -s 100 -T c ./dbgen -s 100 -T l ./dbgen -s 100 -T p ./dbgen -s 100 -T s ./dbgen -s 100 -T d 父主题: SSB测试过程
  • SSB测试结果 经过针对SSB宽表场景对DWS和开源OLAP产品ClickHouse的对比测试发现: 使用hstore_opt表,配合turbo存储、turbo引擎, DWS查询性能整体优于开源产品ClickHouse 1.3倍。 固定query_dop=16调优后,DWS查询性能全面超越ClickHouse,是该产品的3.73倍。 表1 SSB测试结果 SSB DWS ClickHouse - 开箱性能 query_dop=16 - Q1.1 0.0670 0.05 0.059 Q1.2 0.0264 0.022 0.021 Q1.3 0.0836 0.057 0.022 Q2.1 0.2309 0.041 0.254 Q2.2 0.3015 0.163 0.281 Q2.3 0.2398 0.05 0.214 Q3.1 0.3182 0.074 0.434 Q3.2 0.1823 0.042 0.348 Q3.3 0.1759 0.081 0.299 Q3.4 0.0239 0.014 0.025 Q4.1 0.2951 0.103 0.456 Q4.2 0.0942 0.037 0.171 Q4.3 0.0645 0.02 0.146 总时长(s) 2.1032 0.754 2.73 父主题: SSB性能测试
  • SQL20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 select i_item_id ,i_item_desc ,i_category ,i_class ,i_current_price ,sum(cs_ext_sales_price) as itemrevenue ,sum(cs_ext_sales_price)*100/sum(sum(cs_ext_sales_price)) over (partition by i_class) as revenueratio from catalog_sales ,item ,date_dim where cs_item_sk = i_item_sk and i_category in ('Sports', 'Shoes', 'Women') and cs_sold_date_sk = d_date_sk and d_date between cast('2001-03-21' as date) and (cast('2001-03-21' as date) + 30) group by i_item_id ,i_item_desc ,i_category ,i_class ,i_current_price order by i_category ,i_class ,i_item_id ,i_item_desc ,revenueratio limit 100;
  • SQL18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 select i_item_id, ca_country, ca_state, ca_county, avg( cast(cs_quantity as decimal(12,2))) agg1, avg( cast(cs_list_price as decimal(12,2))) agg2, avg( cast(cs_coupon_amt as decimal(12,2))) agg3, avg( cast(cs_sales_price as decimal(12,2))) agg4, avg( cast(cs_net_profit as decimal(12,2))) agg5, avg( cast(c_birth_year as decimal(12,2))) agg6, avg( cast(cd1.cd_dep_count as decimal(12,2))) agg7 from catalog_sales, customer_demographics cd1, customer_demographics cd2, customer, customer_address, date_dim, item where cs_sold_date_sk = d_date_sk and cs_item_sk = i_item_sk and cs_bill_cdemo_sk = cd1.cd_demo_sk and cs_bill_customer_sk = c_customer_sk and cd1.cd_gender = 'M' and cd1.cd_education_status = 'Primary' and c_current_cdemo_sk = cd2.cd_demo_sk and c_current_addr_sk = ca_address_sk and c_birth_month in (10,1,8,7,3,5) and d_year = 1998 and ca_state in ('NE','OK','NC' ,'CO','ID','AR','MO') group by rollup (i_item_id, ca_country, ca_state, ca_county) order by ca_country, ca_state, ca_county, i_item_id limit 100;
  • SQL13 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 select avg(ss_quantity) ,avg(ss_ext_sales_price) ,avg(ss_ext_wholesale_cost) ,sum(ss_ext_wholesale_cost) from store_sales ,store ,customer_demographics ,household_demographics ,customer_address ,date_dim where s_store_sk = ss_store_sk and ss_sold_date_sk = d_date_sk and d_year = 2001 and((ss_hdemo_sk=hd_demo_sk and cd_demo_sk = ss_cdemo_sk and cd_marital_status = 'U' and cd_education_status = '4 yr Degree' and ss_sales_price between 100.00 and 150.00 and hd_dep_count = 3 )or (ss_hdemo_sk=hd_demo_sk and cd_demo_sk = ss_cdemo_sk and cd_marital_status = 'D' and cd_education_status = '2 yr Degree' and ss_sales_price between 50.00 and 100.00 and hd_dep_count = 1 ) or (ss_hdemo_sk=hd_demo_sk and cd_demo_sk = ss_cdemo_sk and cd_marital_status = 'S' and cd_education_status = 'Advanced Degree' and ss_sales_price between 150.00 and 200.00 and hd_dep_count = 1 )) and((ss_addr_sk = ca_address_sk and ca_country = 'United States' and ca_state in ('IL', 'WI', 'TN') and ss_net_profit between 100 and 200 ) or (ss_addr_sk = ca_address_sk and ca_country = 'United States' and ca_state in ('MO', 'OK', 'WA') and ss_net_profit between 150 and 300 ) or (ss_addr_sk = ca_address_sk and ca_country = 'United States' and ca_state in ('NE', 'VA', 'GA') and ss_net_profit between 50 and 250 )) ;
  • SQL12 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 select i_item_id ,i_item_desc ,i_category ,i_class ,i_current_price ,sum(ws_ext_sales_price) as itemrevenue ,sum(ws_ext_sales_price)*100/sum(sum(ws_ext_sales_price)) over (partition by i_class) as revenueratio from web_sales ,item ,date_dim where ws_item_sk = i_item_sk and i_category in ('Music', 'Shoes', 'Children') and ws_sold_date_sk = d_date_sk and d_date between cast('2000-05-14' as date) and (cast('2000-05-14' as date) + 30 ) group by i_item_id ,i_item_desc ,i_category ,i_class ,i_current_price order by i_category ,i_class ,i_item_id ,i_item_desc ,revenueratio limit 100;
  • SQL17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 select i_item_id ,i_item_desc ,s_state ,count(ss_quantity) as store_sales_quantitycount ,avg(ss_quantity) as store_sales_quantityave ,stddev_samp(ss_quantity) as store_sales_quantitystdev ,stddev_samp(ss_quantity)/avg(ss_quantity) as store_sales_quantitycov ,count(sr_return_quantity) as store_returns_quantitycount ,avg(sr_return_quantity) as store_returns_quantityave ,stddev_samp(sr_return_quantity) as store_returns_quantitystdev ,stddev_samp(sr_return_quantity)/avg(sr_return_quantity) as store_returns_quantitycov ,count(cs_quantity) as catalog_sales_quantitycount ,avg(cs_quantity) as catalog_sales_quantityave ,stddev_samp(cs_quantity) as catalog_sales_quantitystdev ,stddev_samp(cs_quantity)/avg(cs_quantity) as catalog_sales_quantitycov from store_sales ,store_returns ,catalog_sales ,date_dim d1 ,date_dim d2 ,date_dim d3 ,store ,item where d1.d_quarter_name = '2000Q1' and d1.d_date_sk = ss_sold_date_sk and i_item_sk = ss_item_sk and s_store_sk = ss_store_sk and ss_customer_sk = sr_customer_sk and ss_item_sk = sr_item_sk and ss_ticket_number = sr_ticket_number and sr_returned_date_sk = d2.d_date_sk and d2.d_quarter_name in ('2000Q1','2000Q2','2000Q3') and sr_customer_sk = cs_bill_customer_sk and sr_item_sk = cs_item_sk and cs_sold_date_sk = d3.d_date_sk and d3.d_quarter_name in ('2000Q1','2000Q2','2000Q3') group by i_item_id ,i_item_desc ,s_state order by i_item_id ,i_item_desc ,s_state limit 100;
  • SQL7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 select i_item_id, avg(ss_quantity) agg1, avg(ss_list_price) agg2, avg(ss_coupon_amt) agg3, avg(ss_sales_price) agg4 from store_sales, customer_demographics, date_dim, item, promotion where ss_sold_date_sk = d_date_sk and ss_item_sk = i_item_sk and ss_cdemo_sk = cd_demo_sk and ss_promo_sk = p_promo_sk and cd_gender = 'M' and cd_marital_status = 'U' and cd_education_status = 'College' and (p_channel_email = 'N' or p_channel_event = 'N') and d_year = 1999 group by i_item_id order by i_item_id limit 100;
  • SQL10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 select cd_gender, cd_marital_status, cd_education_status, count(*) cnt1, cd_purchase_estimate, count(*) cnt2, cd_credit_rating, count(*) cnt3, cd_dep_count, count(*) cnt4, cd_dep_employed_count, count(*) cnt5, cd_dep_college_count, count(*) cnt6 from customer c,customer_address ca,customer_demographics where c.c_current_addr_sk = ca.ca_address_sk and ca_county in ('Clark County','Richardson County','Tom Green County','Sullivan County','Cass County') and cd_demo_sk = c.c_current_cdemo_sk and exists (select * from store_sales,date_dim where c.c_customer_sk = ss_customer_sk and ss_sold_date_sk = d_date_sk and d_year = 2000 and d_moy between 1 and 1+3) and (exists (select * from web_sales,date_dim where c.c_customer_sk = ws_bill_customer_sk and ws_sold_date_sk = d_date_sk and d_year = 2000 and d_moy between 1 ANd 1+3) or exists (select * from catalog_sales,date_dim where c.c_customer_sk = cs_ship_customer_sk and cs_sold_date_sk = d_date_sk and d_year = 2000 and d_moy between 1 and 1+3)) group by cd_gender, cd_marital_status, cd_education_status, cd_purchase_estimate, cd_credit_rating, cd_dep_count, cd_dep_employed_count, cd_dep_college_count order by cd_gender, cd_marital_status, cd_education_status, cd_purchase_estimate, cd_credit_rating, cd_dep_count, cd_dep_employed_count, cd_dep_college_count limit 100;
  • SQL5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 with ssr as (select s_store_id, sum(sales_price) as sales, sum(profit) as profit, sum(return_amt) as returns, sum(net_loss) as profit_loss from ( select ss_store_sk as store_sk, ss_sold_date_sk as date_sk, ss_ext_sales_price as sales_price, ss_net_profit as profit, cast(0 as decimal(7,2)) as return_amt, cast(0 as decimal(7,2)) as net_loss from store_sales union all select sr_store_sk as store_sk, sr_returned_date_sk as date_sk, cast(0 as decimal(7,2)) as sales_price, cast(0 as decimal(7,2)) as profit, sr_return_amt as return_amt, sr_net_loss as net_loss from store_returns ) salesreturns, date_dim, store where date_sk = d_date_sk and d_date between cast('2002-08-05' as date) and (cast('2002-08-05' as date) + 14 ) and store_sk = s_store_sk group by s_store_id) , csr as (select cp_catalog_page_id, sum(sales_price) as sales, sum(profit) as profit, sum(return_amt) as returns, sum(net_loss) as profit_loss from ( select cs_catalog_page_sk as page_sk, cs_sold_date_sk as date_sk, cs_ext_sales_price as sales_price, cs_net_profit as profit, cast(0 as decimal(7,2)) as return_amt, cast(0 as decimal(7,2)) as net_loss from catalog_sales union all select cr_catalog_page_sk as page_sk, cr_returned_date_sk as date_sk, cast(0 as decimal(7,2)) as sales_price, cast(0 as decimal(7,2)) as profit, cr_return_amount as return_amt, cr_net_loss as net_loss from catalog_returns ) salesreturns, date_dim, catalog_page where date_sk = d_date_sk and d_date between cast('2002-08-05' as date) and (cast('2002-08-05' as date) + 14 ) and page_sk = cp_catalog_page_sk group by cp_catalog_page_id) , wsr as (select web_site_id, sum(sales_price) as sales, sum(profit) as profit, sum(return_amt) as returns, sum(net_loss) as profit_loss from ( select ws_web_site_sk as wsr_web_site_sk, ws_sold_date_sk as date_sk, ws_ext_sales_price as sales_price, ws_net_profit as profit, cast(0 as decimal(7,2)) as return_amt, cast(0 as decimal(7,2)) as net_loss from web_sales union all select ws_web_site_sk as wsr_web_site_sk, wr_returned_date_sk as date_sk, cast(0 as decimal(7,2)) as sales_price, cast(0 as decimal(7,2)) as profit, wr_return_amt as return_amt, wr_net_loss as net_loss from web_returns left outer join web_sales on ( wr_item_sk = ws_item_sk and wr_order_number = ws_order_number) ) salesreturns, date_dim, web_site where date_sk = d_date_sk and d_date between cast('2002-08-05' as date) and (cast('2002-08-05' as date) + 14 ) and wsr_web_site_sk = web_site_sk group by web_site_id) select channel , id , sum(sales) as sales , sum(returns) as returns , sum(profit) as profit from (select 'store channel' as channel , 'store' || s_store_id as id , sales , returns , (profit - profit_loss) as profit from ssr union all select 'catalog channel' as channel , 'catalog_page' || cp_catalog_page_id as id , sales , returns , (profit - profit_loss) as profit from csr union all select 'web channel' as channel , 'web_site' || web_site_id as id , sales , returns , (profit - profit_loss) as profit from wsr ) x group by rollup (channel, id) order by channel ,id limit 100;
  • SQL3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 select dt.d_year ,item.i_brand_id brand_id ,item.i_brand brand ,sum(ss_ext_sales_price) sum_agg from date_dim dt ,store_sales ,item where dt.d_date_sk = store_sales.ss_sold_date_sk and store_sales.ss_item_sk = item.i_item_sk and item.i_manufact_id = 125 and dt.d_moy=11 group by dt.d_year ,item.i_brand ,item.i_brand_id order by dt.d_year ,sum_agg desc ,brand_id limit 100;
  • SQL2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 with wscs as (select sold_date_sk ,sales_price from (select ws_sold_date_sk sold_date_sk ,ws_ext_sales_price sales_price from web_sales union all select cs_sold_date_sk sold_date_sk ,cs_ext_sales_price sales_price from catalog_sales)), wswscs as (select d_week_seq, sum(case when (d_day_name='Sunday') then sales_price else null end) sun_sales, sum(case when (d_day_name='Monday') then sales_price else null end) mon_sales, sum(case when (d_day_name='Tuesday') then sales_price else null end) tue_sales, sum(case when (d_day_name='Wednesday') then sales_price else null end) wed_sales, sum(case when (d_day_name='Thursday') then sales_price else null end) thu_sales, sum(case when (d_day_name='Friday') then sales_price else null end) fri_sales, sum(case when (d_day_name='Saturday') then sales_price else null end) sat_sales from wscs ,date_dim where d_date_sk = sold_date_sk group by d_week_seq) select d_week_seq1 ,round(sun_sales1/sun_sales2,2) ,round(mon_sales1/mon_sales2,2) ,round(tue_sales1/tue_sales2,2) ,round(wed_sales1/wed_sales2,2) ,round(thu_sales1/thu_sales2,2) ,round(fri_sales1/fri_sales2,2) ,round(sat_sales1/sat_sales2,2) from (select wswscs.d_week_seq d_week_seq1 ,sun_sales sun_sales1 ,mon_sales mon_sales1 ,tue_sales tue_sales1 ,wed_sales wed_sales1 ,thu_sales thu_sales1 ,fri_sales fri_sales1 ,sat_sales sat_sales1 from wswscs,date_dim where date_dim.d_week_seq = wswscs.d_week_seq and d_year = 1999) y, (select wswscs.d_week_seq d_week_seq2 ,sun_sales sun_sales2 ,mon_sales mon_sales2 ,tue_sales tue_sales2 ,wed_sales wed_sales2 ,thu_sales thu_sales2 ,fri_sales fri_sales2 ,sat_sales sat_sales2 from wswscs ,date_dim where date_dim.d_week_seq = wswscs.d_week_seq and d_year = 1999+1) z where d_week_seq1=d_week_seq2-53 order by d_week_seq1;
  • 命令生成方法 TPC-DS标准99个SQL查询语句可用如下方法生成: 准备工作。生成TPC-DS查询语句前需要修改query_templates目录下的文件: 登录测试过程申请的E CS ,进入/data1/script/tpcds-kit/DSGen-software-code-3.2.0rc1/query_templates目录: 1 cd /data1/script/tpcds-kit/DSGen-software-code-3.2.0rc1/query_templates 新建文件hwdws.tpl,内容为: 1 2 3 4 5 define __LIMITA = ""; define __LIMITB = ""; define __LIMITC = "limit %d"; define _BEGIN = "-- begin query " + [_QUERY] + " in stream " + [_STREAM] + " using template " + [_TEMPLATE]; define _END = "-- end query " + [_QUERY] + " in stream " + [_STREAM] + " using template " + [_TEMPLATE]; 因TPC-DS工具中SQL语句生成模板有语法错误,需修改query77.tpl,将135行的‘, coalesce(returns, 0) returns’改为‘, coalesce(returns, 0) as returns’。 执行以下命令生成查询语句: 1 2 cd /data1/script/tpcds-kit/DSGen-software-code-3.2.0rc1/tools ./dsqgen -input ../query_templates/templates.lst -directory ../query_templates/ -scale 1000 -dialect hwdws 执行后会生成query_0.sql文件,里面放着99个标准SQL语句,需要手动去切分成99个文件。 生成的标准查询中如下日期函数语法在 GaussDB (DWS)暂不支持,需要手动进行修改: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 Q5: and (cast('2001-08-19' as date) + 14 days) 修改为 and (cast('2001-08-19' as date) + 14) Q12:and (cast('1999-02-28' as date) + 30 days) 修改为 and (cast('1999-02-28' as date) + 30) Q16:(cast('1999-4-01' as date) + 60 days) 修改为 (cast('1999-4-01' as date) + 60) Q20:and (cast('1998-05-05' as date) + 30 days) 修改为 and (cast('1998-05-05' as date) + 30) Q21:and d_date between (cast ('2000-05-19' as date) - 30 days) 修改为 and d_date between (cast ('2000-05-19' as date) - 30) and (cast ('2000-05-19' as date) + 30 days) 修改为 and (cast ('2000-05-19' as date) + 30) Q32:(cast('1999-02-22' as date) + 90 days) 修改为 (cast('1999-02-22' as date) + 90) Q37:and d_date between cast('1998-04-29' as date) and (cast('1998-04-29' as date) + 60 days) 修改为 and d_date between cast('1998-04-29' as date) and (cast('1998-04-29' as date) + 60) Q40:and d_date between (cast ('2002-05-10' as date) - 30 days) 修改为 and d_date between (cast ('2002-05-10' as date) - 30) and (cast ('2002-05-10' as date) + 30 days) 修改为 and (cast ('2002-05-10' as date) + 30) Q77:and (cast('1999-08-29' as date) + 30 days) 修改为 and (cast('1999-08-29' as date) + 30) Q80:and (cast('2002-08-04' as date) + 30 days) 修改为 and (cast('2002-08-04' as date) + 30) Q82:and d_date between cast('1998-01-18' as date) and (cast('1998-01-18' as date) + 60 days) 修改为 and d_date between cast('1998-01-18' as date) and (cast('1998-01-18' as date) + 60) Q92:(cast('2001-01-26' as date) + 90 days) 修改为 (cast('2001-01-26' as date) + 90) Q94:(cast('1999-5-01' as date) + 60 days) 修改为 (cast('1999-5-01' as date) + 60) Q95:(cast('1999-4-01' as date) + 60 days) 修改为 (cast('1999-4-01' as date) + 60) Q98:and (cast('2002-04-01' as date) + 30 days) 修改为 and (cast('2002-04-01' as date) + 30)
  • 导入TPC-DS数据 执行以下命令导入数据。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 INSERT INTO customer_address SELECT * FROM customer_address_ext; INSERT INTO customer_demographics SELECT * FROM customer_demographics_ext; INSERT INTO date_dim SELECT * FROM date_dim_ext; INSERT INTO warehouse SELECT * FROM warehouse_ext; INSERT INTO ship_mode SELECT * FROM ship_mode_ext; INSERT INTO time_dim SELECT * FROM time_dim_ext; INSERT INTO reason SELECT * FROM reason_ext; INSERT INTO income_band SELECT * FROM income_band_ext; INSERT INTO item SELECT * FROM item_ext; INSERT INTO store SELECT * FROM store_ext; INSERT INTO call_center SELECT * FROM call_center_ext; INSERT INTO customer SELECT * FROM customer_ext; INSERT INTO web_site SELECT * FROM web_site_ext; INSERT INTO household_demographics SELECT * FROM household_demographics_ext; INSERT INTO web_page SELECT * FROM web_page_ext; INSERT INTO promotion SELECT * FROM promotion_ext; INSERT INTO catalog_page SELECT * FROM catalog_page_ext; INSERT INTO inventory SELECT * FROM inventory_ext; INSERT INTO catalog_returns SELECT * FROM catalog_returns_ext; INSERT INTO web_returns SELECT * FROM web_returns_ext; INSERT INTO store_returns SELECT * FROM store_returns_ext; INSERT INTO web_sales SELECT * FROM web_sales_ext; INSERT INTO catalog_sales SELECT * FROM catalog_sales_ext; INSERT INTO store_sales SELECT * FROM store_sales_ext;
  • 创建TPC-DS目标表 连接DWS数据库后执行以下SQL语句。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 CREATE TABLE customer_address ( ca_address_sk integer not null, ca_address_id varchar(16) not null, ca_street_number varchar(10) , ca_street_name varchar(60) , ca_street_type varchar(15) , ca_suite_number varchar(10) , ca_city varchar(60) , ca_county varchar(30) , ca_state varchar(2) , ca_zip varchar(10) , ca_country varchar(20) , ca_gmt_offset decimal(5,2) , ca_location_type varchar(20) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (ca_address_sk); CREATE TABLE customer_demographics ( cd_demo_sk integer not null, cd_gender varchar(1) , cd_marital_status varchar(1) , cd_education_status varchar(20) , cd_purchase_estimate integer , cd_credit_rating varchar(10) , cd_dep_count integer , cd_dep_employed_count integer , cd_dep_college_count integer ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (cd_demo_sk); CREATE TABLE date_dim ( d_date_sk integer not null, d_date_id varchar(16) not null, d_date date , d_month_seq integer , d_week_seq integer , d_quarter_seq integer , d_year integer , d_dow integer , d_moy integer , d_dom integer , d_qoy integer , d_fy_year integer , d_fy_quarter_seq integer , d_fy_week_seq integer , d_day_name varchar(9) , d_quarter_name varchar(6) , d_holiday varchar(1) , d_weekend varchar(1) , d_following_holiday varchar(1) , d_first_dom integer , d_last_dom integer , d_same_day_ly integer , d_same_day_lq integer , d_current_day varchar(1) , d_current_week varchar(1) , d_current_month varchar(1) , d_current_quarter varchar(1) , d_current_year varchar(1) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (d_date_sk) PARTITION BY Range(d_year) ( partition p1 values less than(1950), partition p2 values less than(2000), partition p3 values less than(2050), partition p4 values less than(2100), partition p5 values less than(3000), partition p6 values less than(maxvalue) ); create table warehouse ( w_warehouse_sk integer not null, w_warehouse_id varchar(16) not null, w_warehouse_name varchar(20) , w_warehouse_sq_ft integer , w_street_number varchar(10) , w_street_name varchar(60) , w_street_type varchar(15) , w_suite_number varchar(10) , w_city varchar(60) , w_county varchar(30) , w_state varchar(2) , w_zip varchar(10) , w_country varchar(20) , w_gmt_offset decimal(5,2) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY replication; create table ship_mode ( sm_ship_mode_sk integer not null, sm_ship_mode_id varchar(16) not null, sm_type varchar(30) , sm_code varchar(10) , sm_carrier varchar(20) , sm_contract varchar(20) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY replication; create table time_dim ( t_time_sk integer not null, t_time_id varchar(16) not null, t_time integer , t_hour integer , t_minute integer , t_second integer , t_am_pm varchar(2) , t_shift varchar(20) , t_sub_shift varchar(20) , t_meal_time varchar(20) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (t_time_sk); create table reason ( r_reason_sk integer not null, r_reason_id varchar(16) not null, r_reason_desc varchar(100) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY replication; create table income_band ( ib_income_band_sk integer not null, ib_lower_bound integer , ib_upper_bound integer ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY replication; create table item ( i_item_sk integer not null, i_item_id varchar(16) not null, i_rec_start_date date , i_rec_end_date date , i_item_desc varchar(200) , i_current_price decimal(7,2) , i_wholesale_cost decimal(7,2) , i_brand_id integer , i_brand varchar(50) , i_class_id integer , i_class varchar(50) , i_category_id integer , i_category varchar(50) , i_manufact_id integer , i_manufact varchar(50) , i_size varchar(20) , i_formulation varchar(20) , i_color varchar(20) , i_units varchar(10) , i_container varchar(10) , i_manager_id integer , i_product_name varchar(50) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (i_item_sk); create table store ( s_store_sk integer not null, s_store_id varchar(16) not null, s_rec_start_date date , s_rec_end_date date , s_closed_date_sk integer , s_store_name varchar(50) , s_number_employees integer , s_floor_space integer , s_hours varchar(20) , s_manager varchar(40) , s_market_id integer , s_geography_class varchar(100) , s_market_desc varchar(100) , s_market_manager varchar(40) , s_division_id integer , s_division_name varchar(50) , s_company_id integer , s_company_name varchar(50) , s_street_number varchar(10) , s_street_name varchar(60) , s_street_type varchar(15) , s_suite_number varchar(10) , s_city varchar(60) , s_county varchar(30) , s_state varchar(2) , s_zip varchar(10) , s_country varchar(20) , s_gmt_offset decimal(5,2) , s_tax_precentage decimal(5,2) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY replication; create table call_center ( cc_call_center_sk integer not null, cc_call_center_id varchar(16) not null, cc_rec_start_date date , cc_rec_end_date date , cc_closed_date_sk integer , cc_open_date_sk integer , cc_name varchar(50) , cc_class varchar(50) , cc_employees integer , cc_sq_ft integer , cc_hours varchar(20) , cc_manager varchar(40) , cc_mkt_id integer , cc_mkt_class varchar(50) , cc_mkt_desc varchar(100) , cc_market_manager varchar(40) , cc_division integer , cc_division_name varchar(50) , cc_company integer , cc_company_name varchar(50) , cc_street_number varchar(10) , cc_street_name varchar(60) , cc_street_type varchar(15) , cc_suite_number varchar(10) , cc_city varchar(60) , cc_county varchar(30) , cc_state varchar(2) , cc_zip varchar(10) , cc_country varchar(20) , cc_gmt_offset decimal(5,2) , cc_tax_percentage decimal(5,2) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY replication; create table customer ( c_customer_sk integer not null, c_customer_id varchar(16) not null, c_current_cdemo_sk integer , c_current_hdemo_sk integer , c_current_addr_sk integer , c_first_shipto_date_sk integer , c_first_sales_date_sk integer , c_salutation varchar(10) , c_first_name varchar(20) , c_last_name varchar(30) , c_preferred_cust_flag varchar(1) , c_birth_day integer , c_birth_month integer , c_birth_year integer , c_birth_country varchar(20) , c_login varchar(13) , c_email_address varchar(50) , c_last_review_date varchar(10) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (c_customer_sk); create table web_site ( web_site_sk integer not null, web_site_id varchar(16) not null, web_rec_start_date date , web_rec_end_date date , web_name varchar(50) , web_open_date_sk integer , web_close_date_sk integer , web_class varchar(50) , web_manager varchar(40) , web_mkt_id integer , web_mkt_class varchar(50) , web_mkt_desc varchar(100) , web_market_manager varchar(40) , web_company_id integer , web_company_name varchar(50) , web_street_number varchar(10) , web_street_name varchar(60) , web_street_type varchar(15) , web_suite_number varchar(10) , web_city varchar(60) , web_county varchar(30) , web_state varchar(2) , web_zip varchar(10) , web_country varchar(20) , web_gmt_offset decimal(5,2) , web_tax_percentage decimal(5,2) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY replication; create table household_demographics ( hd_demo_sk integer not null, hd_income_band_sk integer , hd_buy_potential varchar(15) , hd_dep_count integer , hd_vehicle_count integer ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (hd_demo_sk); create table web_page ( wp_web_page_sk integer not null, wp_web_page_id varchar(16) not null, wp_rec_start_date date , wp_rec_end_date date , wp_creation_date_sk integer , wp_access_date_sk integer , wp_autogen_flag varchar(1) , wp_customer_sk integer , wp_url varchar(100) , wp_type varchar(50) , wp_char_count integer , wp_link_count integer , wp_image_count integer , wp_max_ad_count integer ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY replication; create table promotion ( p_promo_sk integer not null, p_promo_id varchar(16) not null, p_start_date_sk integer , p_end_date_sk integer , p_item_sk integer , p_cost decimal(15,2) , p_response_target integer , p_promo_name varchar(50) , p_channel_dmail varchar(1) , p_channel_email varchar(1) , p_channel_catalog varchar(1) , p_channel_tv varchar(1) , p_channel_radio varchar(1) , p_channel_press varchar(1) , p_channel_event varchar(1) , p_channel_demo varchar(1) , p_channel_details varchar(100) , p_purpose varchar(15) , p_discount_active varchar(1) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY replication; create table catalog_page ( cp_catalog_page_sk integer not null, cp_catalog_page_id varchar(16) not null, cp_start_date_sk integer , cp_end_date_sk integer , cp_department varchar(50) , cp_catalog_number integer , cp_catalog_page_number integer , cp_description varchar(100) , cp_type varchar(100) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (cp_catalog_page_sk); create table inventory ( inv_date_sk integer not null, inv_item_sk integer not null, inv_warehouse_sk integer not null, inv_quantity_on_hand integer ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (inv_item_sk) partition by range(inv_date_sk) ( partition p1 values less than(2451179), partition p2 values less than(2451544), partition p3 values less than(2451910), partition p4 values less than(2452275), partition p5 values less than(2452640), partition p6 values less than(2453005), partition p7 values less than(maxvalue) ) ; create table catalog_returns ( cr_returned_date_sk integer , cr_returned_time_sk integer , cr_item_sk integer not null, cr_refunded_customer_sk integer , cr_refunded_cdemo_sk integer , cr_refunded_hdemo_sk integer , cr_refunded_addr_sk integer , cr_returning_customer_sk integer , cr_returning_cdemo_sk integer , cr_returning_hdemo_sk integer , cr_returning_addr_sk integer , cr_call_center_sk integer , cr_catalog_page_sk integer , cr_ship_mode_sk integer , cr_warehouse_sk integer , cr_reason_sk integer , cr_order_number bigint not null, cr_return_quantity integer , cr_return_amount decimal(7,2) , cr_return_tax decimal(7,2) , cr_return_amt_inc_tax decimal(7,2) , cr_fee decimal(7,2) , cr_return_ship_cost decimal(7,2) , cr_refunded_cash decimal(7,2) , cr_reversed_charge decimal(7,2) , cr_store_credit decimal(7,2) , cr_net_loss decimal(7,2) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (cr_item_sk) partition by range(cr_returned_date_sk) ( partition p1 values less than(2450815), partition p2 values less than(2451179), partition p3 values less than(2451544), partition p4 values less than(2451910), partition p5 values less than(2452275), partition p6 values less than(2452640), partition p7 values less than(2453005), partition p8 values less than(maxvalue) ) ; create table web_returns ( wr_returned_date_sk integer , wr_returned_time_sk integer , wr_item_sk integer not null, wr_refunded_customer_sk integer , wr_refunded_cdemo_sk integer , wr_refunded_hdemo_sk integer , wr_refunded_addr_sk integer , wr_returning_customer_sk integer , wr_returning_cdemo_sk integer , wr_returning_hdemo_sk integer , wr_returning_addr_sk integer , wr_web_page_sk integer , wr_reason_sk integer , wr_order_number bigint not null, wr_return_quantity integer , wr_return_amt decimal(7,2) , wr_return_tax decimal(7,2) , wr_return_amt_inc_tax decimal(7,2) , wr_fee decimal(7,2) , wr_return_ship_cost decimal(7,2) , wr_refunded_cash decimal(7,2) , wr_reversed_charge decimal(7,2) , wr_account_credit decimal(7,2) , wr_net_loss decimal(7,2) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (wr_item_sk) partition by range(wr_returned_date_sk) ( partition p1 values less than(2450815), partition p2 values less than(2451179), partition p3 values less than(2451544), partition p4 values less than(2451910), partition p5 values less than(2452275), partition p6 values less than(2452640), partition p7 values less than(2453005), partition p8 values less than(maxvalue) ) ; create table store_returns ( sr_returned_date_sk integer , sr_return_time_sk integer , sr_item_sk integer not null, sr_customer_sk integer , sr_cdemo_sk integer , sr_hdemo_sk integer , sr_addr_sk integer , sr_store_sk integer , sr_reason_sk integer , sr_ticket_number bigint not null, sr_return_quantity integer , sr_return_amt decimal(7,2) , sr_return_tax decimal(7,2) , sr_return_amt_inc_tax decimal(7,2) , sr_fee decimal(7,2) , sr_return_ship_cost decimal(7,2) , sr_refunded_cash decimal(7,2) , sr_reversed_charge decimal(7,2) , sr_store_credit decimal(7,2) , sr_net_loss decimal(7,2) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (sr_item_sk) partition by range(sr_returned_date_sk) ( partition p1 values less than (2451179) , partition p2 values less than (2451544) , partition p3 values less than (2451910) , partition p4 values less than (2452275) , partition p5 values less than (2452640) , partition p6 values less than (2453005) , partition p7 values less than (maxvalue) ) ; create table web_sales ( ws_sold_date_sk integer , ws_sold_time_sk integer , ws_ship_date_sk integer , ws_item_sk integer not null, ws_bill_customer_sk integer , ws_bill_cdemo_sk integer , ws_bill_hdemo_sk integer , ws_bill_addr_sk integer , ws_ship_customer_sk integer , ws_ship_cdemo_sk integer , ws_ship_hdemo_sk integer , ws_ship_addr_sk integer , ws_web_page_sk integer , ws_web_site_sk integer , ws_ship_mode_sk integer , ws_warehouse_sk integer , ws_promo_sk integer , ws_order_number bigint not null, ws_quantity integer , ws_wholesale_cost decimal(7,2) , ws_list_price decimal(7,2) , ws_sales_price decimal(7,2) , ws_ext_discount_amt decimal(7,2) , ws_ext_sales_price decimal(7,2) , ws_ext_wholesale_cost decimal(7,2) , ws_ext_list_price decimal(7,2) , ws_ext_tax decimal(7,2) , ws_coupon_amt decimal(7,2) , ws_ext_ship_cost decimal(7,2) , ws_net_paid decimal(7,2) , ws_net_paid_inc_tax decimal(7,2) , ws_net_paid_inc_ship decimal(7,2) , ws_net_paid_inc_ship_tax decimal(7,2) , ws_net_profit decimal(7,2) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (ws_item_sk) partition by range(ws_sold_date_sk) ( partition p1 values less than(2451179), partition p2 values less than(2451544), partition p3 values less than(2451910), partition p4 values less than(2452275), partition p5 values less than(2452640), partition p6 values less than(2453005), partition p7 values less than(maxvalue) ) ; create table catalog_sales ( cs_sold_date_sk integer , cs_sold_time_sk integer , cs_ship_date_sk integer , cs_bill_customer_sk integer , cs_bill_cdemo_sk integer , cs_bill_hdemo_sk integer , cs_bill_addr_sk integer , cs_ship_customer_sk integer , cs_ship_cdemo_sk integer , cs_ship_hdemo_sk integer , cs_ship_addr_sk integer , cs_call_center_sk integer , cs_catalog_page_sk integer , cs_ship_mode_sk integer , cs_warehouse_sk integer , cs_item_sk integer not null, cs_promo_sk integer , cs_order_number bigint not null, cs_quantity integer , cs_wholesale_cost decimal(7,2) , cs_list_price decimal(7,2) , cs_sales_price decimal(7,2) , cs_ext_discount_amt decimal(7,2) , cs_ext_sales_price decimal(7,2) , cs_ext_wholesale_cost decimal(7,2) , cs_ext_list_price decimal(7,2) , cs_ext_tax decimal(7,2) , cs_coupon_amt decimal(7,2) , cs_ext_ship_cost decimal(7,2) , cs_net_paid decimal(7,2) , cs_net_paid_inc_tax decimal(7,2) , cs_net_paid_inc_ship decimal(7,2) , cs_net_paid_inc_ship_tax decimal(7,2) , cs_net_profit decimal(7,2) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (cs_item_sk) partition by range(cs_sold_date_sk) ( partition p1 values less than(2451179), partition p2 values less than(2451544), partition p3 values less than(2451910), partition p4 values less than(2452275), partition p5 values less than(2452640), partition p6 values less than(2453005), partition p7 values less than(maxvalue) ) ; create table store_sales ( ss_sold_date_sk integer , ss_sold_time_sk integer , ss_item_sk integer not null, ss_customer_sk integer , ss_cdemo_sk integer , ss_hdemo_sk integer , ss_addr_sk integer , ss_store_sk integer , ss_promo_sk integer , ss_ticket_number bigint not null, ss_quantity integer , ss_wholesale_cost decimal(7,2) , ss_list_price decimal(7,2) , ss_sales_price decimal(7,2) , ss_ext_discount_amt decimal(7,2) , ss_ext_sales_price decimal(7,2) , ss_ext_wholesale_cost decimal(7,2) , ss_ext_list_price decimal(7,2) , ss_ext_tax decimal(7,2) , ss_coupon_amt decimal(7,2) , ss_net_paid decimal(7,2) , ss_net_paid_inc_tax decimal(7,2) , ss_net_profit decimal(7,2) ) WITH (orientation = column, colversion=2.0,enable_hstore=true,enable_hstore_opt=true) DISTRIBUTE BY hash (ss_item_sk) partition by range(ss_sold_date_sk) ( partition p1 values less than(2451179), partition p2 values less than(2451544), partition p3 values less than(2451910), partition p4 values less than(2452275), partition p5 values less than(2452640), partition p6 values less than(2453005), partition p7 values less than(maxvalue) ) ;
  • TPC-DS测试数据 表1 TPC-DS测试数据 序号 表名 行数 表大小 1 customer_address 6,000,000 126MB 2 customer_demographics 1,920,800 11MB 3 date_dim 73,049 11MB 4 warehouse 20 1200KB 5 ship_mode 20 864KB 6 time_dim 86,400 1520KB 7 reason 65 720KB 8 income_band 20 720KB 9 item 300,000 23MB 10 store 1,002 2400KB 11 call_center 42 1968KB 12 customer 12,000,000 519MB 13 web_site 54 1824KB 14 household_demographics 7,200 1208KB 15 web_page 3,000 2208KB 16 promotion 1,500 2112KB 17 catalog_page 30,000 3536KB 18 inventory 783,000,000 2499MB 19 catalog_returns 143,996,756 8454MB 20 web_returns 71,997,522 3990MB 21 store_returns 287,999,764 13GB 22 web_sales 720,000,376 54GB 23 catalog_sales 1,439,980,416 104GB 24 store_sales 2,879,987,999 142GB 父主题: TPC-DS测试过程
  • TPC-DS测试结果 本测试主要包括使用存算一体和存算分离两种部署架构下,TPC-H 1T规模数据集的开箱查询性能,共99个查询。存算一体查询总耗时为971.45s,存算分离查询总耗时为1035.80s。详细结果见下表。 表1 TPC-DS测试结果 TPC-DS查询 8.3.0 9.1.0 - 存算一体(s) 存算一体(s) 存算分离(s) Q1 2.03 1.21 0.59 Q2 9.14 4.00 5.10 Q3 1.52 1.40 1.96 Q4 200.44 173.61 181.80 Q5 3.11 2.26 3.48 Q6 0.39 0.29 0.43 Q7 1.85 1.74 2.23 Q8 0.72 0.42 0.58 Q9 11.14 15.36 17.16 Q10 1.08 1.07 1.05 Q11 92.20 62.56 66.79 Q12 0.20 0.13 0.22 Q13 2.50 2.86 3.63 Q14 74.98 23.45 24.90 Q15 2.11 0.56 0.45 Q16 6.51 3.28 4.28 Q17 2.93 3.74 5.29 Q18 2.16 1.16 2.06 Q19 0.70 0.69 0.84 Q20 0.18 0.10 0.17 Q21 0.18 0.27 0.17 Q22 5.84 2.00 14.78 Q23 144.71 44.33 48.74 Q24 8.55 4.76 6.74 Q25 3.10 3.34 4.17 Q26 0.63 0.53 0.62 Q27 2.03 1.79 2.77 Q28 13.32 13.20 14.74 Q29 2.50 2.96 3.61 Q30 0.73 0.38 0.44 Q31 3.73 2.85 3.08 Q32 0.18 0.91 0.20 Q33 1.28 1.06 1.22 Q34 2.13 2.51 3.27 Q35 3.00 1.89 2.30 Q36 6.21 1.67 17.93 Q37 0.34 0.39 0.51 Q38 52.24 37.43 37.78 Q39 5.57 3.51 3.11 Q40 0.66 0.13 0.24 Q41 0.04 0.03 0.09 Q42 0.70 0.73 0.60 Q43 1.99 1.35 1.79 Q44 3.25 3.66 4.27 Q45 0.82 0.56 0.79 Q46 4.63 4.44 4.62 Q47 6.91 4.83 6.22 Q48 2.37 2.45 3.55 Q49 3.01 3.13 4.64 Q50 5.82 6.70 5.09 Q51 10.67 5.07 5.25 Q52 0.70 0.72 0.68 Q53 0.88 0.86 1.05 Q54 3.96 3.20 4.21 Q55 0.66 0.53 0.59 Q56 0.84 0.76 0.94 Q57 3.12 2.26 2.09 Q58 0.76 0.49 0.69 Q59 17.30 8.75 10.42 Q60 1.75 1.31 1.46 Q61 1.10 1.03 1.45 Q62 1.29 0.83 1.07 Q63 0.86 0.84 1.05 Q64 14.20 11.57 16.54 Q65 6.92 4.09 4.84 Q66 1.50 1.16 1.35 Q67 153.90 131.56 196.11 Q68 3.65 3.13 3.66 Q69 0.93 0.69 0.82 Q70 23.13 3.07 32.01 Q71 2.33 2.34 2.60 Q72 3.69 4.24 3.81 Q73 1.40 1.72 2.32 Q74 37.27 24.38 27.55 Q75 11.85 5.99 7.91 Q76 3.37 3.21 3.65 Q77 1.30 1.07 1.56 Q78 152.21 97.02 42.98 Q79 4.49 4.25 5.15 Q80 3.56 2.35 3.93 Q81 0.64 0.33 0.42 Q82 0.75 0.70 1.31 Q83 0.15 0.09 0.26 Q84 0.24 0.26 0.42 Q85 2.78 1.81 2.16 Q86 2.59 0.35 3.07 Q87 78.17 123.22 56.21 Q88 6.90 9.40 11.20 Q89 2.61 1.85 1.92 Q90 0.64 0.60 1.13 Q91 0.15 0.12 0.26 Q92 0.20 0.26 0.24 Q93 7.53 7.44 5.84 Q94 3.49 1.93 2.72 Q95 29.57 31.04 28.55 Q96 1.49 1.96 2.66 Q97 8.49 5.31 5.81 Q98 1.09 0.85 0.93 Q99 2.37 1.76 1.82 SUM 1321.757 971.45 1035.80 父主题: TPC-DS性能测试
  • Q13 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 SELECT c_count, count(*) as custdist FROM ( SELECT c_custkey, count(o_orderkey) FROM customer left outer join orders on c_custkey = o_custkey and o_comment not like '%special%requests%' GROUP BY c_custkey ) as c_orders (c_custkey, c_count) GROUP BY c_count ORDER BY custdist desc, c_count desc;
  • Q9 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 SELECT nation, o_year, sum(amount) as sum_profit FROM ( SELECT n_name as nation, extract(year FROM o_orderdate) as o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount FROM part, supplier, lineitem, partsupp, orders, nation WHERE s_suppkey = l_suppkey and ps_suppkey = l_suppkey and ps_partkey = l_partkey and p_partkey = l_partkey and o_orderkey = l_orderkey and s_nationkey = n_nationkey and p_name like '%green%' ) as profit GROUP BY nation, o_year ORDER BY nation, o_year desc;
  • Q8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 SELECT o_year, sum(case when nation = 'BRAZIL' then volume else 0 end) / sum(volume) as mkt_share FROM ( SELECT extract(year FROM o_orderdate) as o_year, l_extendedprice * (1 - l_discount) as volume, n2.n_name as nation FROM part, supplier, lineitem, orders, customer, nation n1, nation n2, region WHERE p_partkey = l_partkey and s_suppkey = l_suppkey and l_orderkey = o_orderkey and o_custkey = c_custkey and c_nationkey = n1.n_nationkey and n1.n_regionkey = r_regionkey and r_name = 'AMERICA' and s_nationkey = n2.n_nationkey and o_orderdate between date '1995-01-01' and date '1996-12-31' and p_type = 'ECONOMY ANODIZED STEEL' ) as all_nations GROUP BY o_year ORDER BY o_year;
  • Q2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey and s_suppkey = ps_suppkey and p_size = 15 and p_type like '%BRASS' and s_nationkey = n_nationkey and n_regionkey = r_regionkey and r_name = 'EUROPE' and ps_supplycost = ( SELECT min(ps_supplycost) FROM partsupp, supplier, nation, region WHERE p_partkey = ps_partkey and s_suppkey = ps_suppkey and s_nationkey = n_nationkey and n_regionkey = r_regionkey and r_name = 'EUROPE' ) ORDER BY s_acctbal desc, n_name, s_name, p_partkey LIMIT 100;
  • Q7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 SELECT supp_nation, cust_nation, l_year, sum(volume) as revenue FROM ( SELECT n1.n_name as supp_nation, n2.n_name as cust_nation, extract(year FROM l_shipdate) as l_year, l_extendedprice * (1 - l_discount) as volume FROM supplier, lineitem, orders, customer, nation n1, nation n2 WHERE s_suppkey = l_suppkey and o_orderkey = l_orderkey and c_custkey = o_custkey and s_nationkey = n1.n_nationkey and c_nationkey = n2.n_nationkey and ( (n1.n_name = 'FRANCE' and n2.n_name = 'GERMANY') or (n1.n_name = 'GERMANY' and n2.n_name = 'FRANCE') ) and l_shipdate between date '1995-01-01' and date '1996-12-31' ) as shipping GROUP BY supp_nation, cust_nation, l_year ORDER BY supp_nation, cust_nation, l_year;
  • 导入TPC-H数据 执行以下SQL语句导入数据。 1 2 3 4 5 6 7 8 INSERT INTO region SELECT * FROM region_load; INSERT INTO nation SELECT * FROM nation_load; INSERT INTO supplier SELECT * FROM supplier_load; INSERT INTO customer SELECT * FROM customer_load; INSERT INTO part SELECT * FROM part_load; INSERT INTO partsupp SELECT * FROM partsupp_load; INSERT INTO orders SELECT * FROM orders_load; INSERT INTO lineitem SELECT * FROM lineitem_load;
共100000条