使用 SSB 对 Presto 进行基准测试

概述

Presto 是一个开源的、分布式的 SQL 查询执行引擎,用于对海量数据执行 SQL 查询。

SSB(Star Schema Benchmark)是一个针对决策分析应用的基准测试,下面介绍如何使用 SSB 对 Presto 进行基准测试。

准备数据

配置 Catalog

如下配置 Hive 数据源:

1cat << EOF > ${PRESTO_HOME}/etc/catalog/hive.properties
2connector.name=hive-hadoop2
3hive.metastore.uri=thrift://localhost:9083
4EOF

定义表

连接 Presto CLI:

1presto-cli --catalog hive --schema ssb

在 Presto CLI 中执行下述 SQL 语句定义相关表:

 1CREATE TABLE IF NOT EXISTS CUSTOMER 
 2( 
 3    C_CUSTKEY     INTEGER,
 4    C_NAME        VARCHAR(25),
 5    C_ADDRESS     VARCHAR(40),
 6    C_CITY        VARCHAR(10),
 7    C_NATION      VARCHAR(15),
 8    C_REGION      VARCHAR(12),
 9    C_PHONE       VARCHAR(15),
10    C_MKTSEGMENT  VARCHAR(10)
11);
12
13CREATE TABLE DATES 
14( 
15    D_DATEKEY          INTEGER,
16    D_DATE             VARCHAR(18),
17    D_DAYOFWEEK        VARCHAR(18),
18    D_MONTH            VARCHAR(9),
19    D_YEAR             INTEGER,
20    D_YEARMONTHNUM     INTEGER,
21    D_YEARMONTH        VARCHAR(7),
22    D_DAYNUMINWEEK     INTEGER,
23    D_DAYNUMINMONTH    INTEGER,
24    D_DAYNUMINYEAR     INTEGER,
25    D_MONTHNUMINYEAR   INTEGER,
26    D_WEEKNUMINYEAR    INTEGER,
27    D_SELLINGSEASON    VARCHAR(12),
28    D_LASTDAYINWEEKFL  INTEGER,
29    D_LASTDAYINMONTHFL INTEGER,
30    D_HOLIDAYFL        INTEGER,
31    D_WEEKDAYFL        INTEGER
32);
33                         
34CREATE TABLE PART  
35( 
36    P_PARTKEY     INTEGER,
37    P_NAME        VARCHAR(22),
38    P_MFGR        VARCHAR(6),
39    P_CATEGORY    VARCHAR(7),
40    P_BRAND       VARCHAR(9),
41    P_COLOR       VARCHAR(11),
42    P_TYPE        VARCHAR(25),
43    P_SIZE        INTEGER,
44    P_CONTAINER   VARCHAR(10)
45);
46
47CREATE TABLE SUPPLIER 
48( 
49    S_SUPPKEY     INTEGER,
50    S_NAME        VARCHAR(25),
51    S_ADDRESS     VARCHAR(25),
52    S_CITY        VARCHAR(10),
53    S_NATION      VARCHAR(15),
54    S_REGION      VARCHAR(12),
55    S_PHONE       VARCHAR(15)
56);
57
58CREATE TABLE LINEORDER 
59( 
60    LO_ORDERKEY       BIGINT,
61    LO_LINENUMBER     BIGINT,
62    LO_CUSTKEY        INTEGER,
63    LO_PARTKEY        INTEGER,
64    LO_SUPPKEY        INTEGER,
65    LO_ORDERDATE      INTEGER,
66    LO_ORDERPRIOTITY  VARCHAR(15),
67    LO_SHIPPRIOTITY   INTEGER,
68    LO_QUANTITY       BIGINT,
69    LO_EXTENDEDPRICE  BIGINT,
70    LO_ORDTOTALPRICE  BIGINT,
71    LO_DISCOUNT       BIGINT,
72    LO_REVENUE        BIGINT,
73    LO_SUPPLYCOST     BIGINT,
74    LO_TAX            BIGINT,
75    LO_COMMITDATE     INTEGER,
76    LO_SHIPMODE       VARCHAR(10)
77);

导入数据

查询集

使用的 SSB 查询集如下:

  1-- PROMPT Q1.1
  2SELECT SUM(LO_EXTENDEDPRICE*LO_DISCOUNT) AS
  3REVENUE
  4FROM  LINEORDER, DATES
  5WHERE  LO_ORDERDATE = D_DATEKEY
  6AND D_YEAR = 1993
  7AND LO_DISCOUNT BETWEEN 1 AND 3
  8AND LO_QUANTITY < 25;
  9
 10-- PROMPT Q1.2
 11SELECT SUM(LO_EXTENDEDPRICE*LO_DISCOUNT) AS
 12REVENUE
 13FROM  LINEORDER, DATES
 14WHERE  LO_ORDERDATE = D_DATEKEY
 15AND D_YEARMONTH = 'Jan1994'
 16AND LO_DISCOUNT BETWEEN 4 AND 6
 17AND LO_QUANTITY BETWEEN  26 AND 35;
 18
 19-- PROMPT Q1.3
 20SELECT SUM(LO_EXTENDEDPRICE*LO_DISCOUNT) AS
 21REVENUE
 22FROM  LINEORDER, DATES
 23WHERE  LO_ORDERDATE = D_DATEKEY
 24AND D_WEEKNUMINYEAR = 6
 25AND D_YEAR = 1994
 26AND LO_DISCOUNT BETWEEN  5 AND 7
 27AND LO_QUANTITY BETWEEN  26 AND 35;
 28
 29
 30-- PROMPT Q2.1
 31SELECT SUM(LO_REVENUE), D_YEAR, P_BRAND
 32FROM LINEORDER, DATES, PART, SUPPLIER
 33WHERE  LO_ORDERDATE = D_DATEKEY
 34AND LO_PARTKEY = P_PARTKEY
 35AND LO_SUPPKEY = S_SUPPKEY
 36AND P_CATEGORY = 'MFGR#12'
 37AND S_REGION = 'AMERICA'
 38GROUP BY D_YEAR, P_BRAND
 39ORDER BY D_YEAR, P_BRAND;
 40
 41-- PROMPT Q2.2
 42SELECT SUM(LO_REVENUE), D_YEAR, P_BRAND
 43FROM LINEORDER, DATES, PART, SUPPLIER
 44WHERE  LO_ORDERDATE = D_DATEKEY
 45AND LO_PARTKEY = P_PARTKEY
 46AND LO_SUPPKEY = S_SUPPKEY
 47AND P_BRAND BETWEEN  'MFGR#2221'
 48AND 'MFGR#2228'
 49AND S_REGION = 'ASIA'
 50GROUP BY D_YEAR, P_BRAND
 51ORDER BY D_YEAR, P_BRAND;
 52
 53-- PROMPT Q2.3
 54SELECT SUM(LO_REVENUE), D_YEAR, P_BRAND
 55FROM LINEORDER, DATES, PART, SUPPLIER
 56WHERE  LO_ORDERDATE = D_DATEKEY
 57AND LO_PARTKEY = P_PARTKEY
 58AND LO_SUPPKEY = S_SUPPKEY
 59AND P_BRAND= 'MFGR#2239'
 60AND S_REGION = 'EUROPE'
 61GROUP BY D_YEAR, P_BRAND
 62ORDER BY D_YEAR, P_BRAND;
 63
 64
 65-- PROMPT Q3.1
 66SELECT C_NATION, S_NATION, D_YEAR,
 67SUM(LO_REVENUE)  AS  REVENUE
 68FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
 69WHERE  LO_CUSTKEY = C_CUSTKEY
 70AND LO_SUPPKEY = S_SUPPKEY
 71AND  LO_ORDERDATE = D_DATEKEY
 72AND C_REGION = 'ASIA'
 73AND S_REGION = 'ASIA'
 74AND D_YEAR >= 1992 AND D_YEAR <= 1997
 75GROUP BY C_NATION, S_NATION, D_YEAR
 76ORDER BY D_YEAR ASC,  REVENUE DESC;
 77
 78-- PROMPT Q3.2
 79SELECT C_CITY, S_CITY, D_YEAR, SUM(LO_REVENUE)
 80AS  REVENUE
 81FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
 82WHERE  LO_CUSTKEY = C_CUSTKEY
 83AND LO_SUPPKEY = S_SUPPKEY
 84AND  LO_ORDERDATE = D_DATEKEY
 85AND C_NATION = 'UNITED STATES'
 86AND S_NATION = 'UNITED STATES'
 87AND D_YEAR >= 1992 AND D_YEAR <= 1997
 88GROUP BY C_CITY, S_CITY, D_YEAR
 89ORDER BY D_YEAR ASC,  REVENUE DESC;
 90
 91-- PROMPT Q3.3
 92SELECT C_CITY, S_CITY, D_YEAR, SUM(LO_REVENUE)
 93AS  REVENUE
 94FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
 95WHERE  LO_CUSTKEY = C_CUSTKEY
 96AND LO_SUPPKEY = S_SUPPKEY
 97AND  LO_ORDERDATE = D_DATEKEY
 98AND  (C_CITY='UNITED KI1'
 99OR C_CITY='UNITED KI5')
100AND (S_CITY='UNITED KI1'
101OR S_CITY='UNITED KI5')
102AND D_YEAR >= 1992 AND D_YEAR <= 1997
103GROUP BY C_CITY, S_CITY, D_YEAR
104ORDER BY D_YEAR ASC,  REVENUE DESC;
105
106-- PROMPT Q3.4
107SELECT C_CITY, S_CITY, D_YEAR, SUM(LO_REVENUE)
108AS  REVENUE
109FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
110WHERE  LO_CUSTKEY = C_CUSTKEY
111AND LO_SUPPKEY = S_SUPPKEY
112AND  LO_ORDERDATE = D_DATEKEY
113AND  (C_CITY='UNITED KI1'
114OR C_CITY='UNITED KI5')
115AND (S_CITY='UNITED KI1'
116OR S_CITY='UNITED KI5')
117AND D_YEARMONTH = 'Dec1997'
118GROUP BY C_CITY, S_CITY, D_YEAR
119ORDER BY D_YEAR ASC,  REVENUE DESC;
120
121
122-- PROMPT Q4.1
123SELECT D_YEAR, C_NATION,
124SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT
125FROM DATES, CUSTOMER, SUPPLIER, PART, LINEORDER
126WHERE  LO_CUSTKEY = C_CUSTKEY
127AND LO_SUPPKEY = S_SUPPKEY
128AND LO_PARTKEY = P_PARTKEY
129AND  LO_ORDERDATE = D_DATEKEY
130AND C_REGION = 'AMERICA'
131AND S_REGION = 'AMERICA'
132AND (P_MFGR = 'MFGR#1'
133OR P_MFGR = 'MFGR#2')
134GROUP BY D_YEAR, C_NATION
135ORDER BY D_YEAR, C_NATION;
136
137-- PROMPT Q4.2
138SELECT D_YEAR, S_NATION, P_CATEGORY,
139SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT
140FROM DATES, CUSTOMER, SUPPLIER, PART, LINEORDER
141WHERE  LO_CUSTKEY = C_CUSTKEY
142AND LO_SUPPKEY = S_SUPPKEY
143AND LO_PARTKEY = P_PARTKEY
144AND  LO_ORDERDATE = D_DATEKEY
145AND C_REGION = 'AMERICA'
146AND S_REGION = 'AMERICA'
147AND (D_YEAR = 1997 OR D_YEAR = 1998)
148AND (P_MFGR = 'MFGR#1'
149OR P_MFGR = 'MFGR#2')
150GROUP BY D_YEAR, S_NATION, P_CATEGORY
151ORDER BY D_YEAR, S_NATION, P_CATEGORY;
152
153-- PROMPT Q4.3
154SELECT D_YEAR, S_CITY, P_BRAND,
155SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT
156FROM DATES, CUSTOMER, SUPPLIER, PART, LINEORDER
157WHERE  LO_CUSTKEY = C_CUSTKEY
158AND LO_SUPPKEY = S_SUPPKEY
159AND LO_PARTKEY = P_PARTKEY
160AND  LO_ORDERDATE = D_DATEKEY
161AND S_NATION = 'UNITED STATES'
162AND (D_YEAR = 1997 OR D_YEAR = 1998)
163AND P_CATEGORY = 'MFGR#14'
164GROUP BY D_YEAR, S_CITY, P_BRAND
165ORDER BY D_YEAR, S_CITY, P_BRAND;

基准测试结果

在 Presto CLI 中执行 4 组共 13 条查询,执行结果如下:

  1presto:default> -- PROMPT Q1.1
  2             -> SELECT SUM(LO_EXTENDEDPRICE*LO_DISCOUNT) AS
  3             -> REVENUE
  4             -> FROM  LINEORDER, DATES
  5             -> WHERE  LO_ORDERDATE = D_DATEKEY
  6             -> AND D_YEAR = 1993
  7             -> AND LO_DISCOUNT BETWEEN 1 AND 3
  8             -> AND LO_QUANTITY < 25;
  9 REVENUE 
 10---------
 11 NULL    
 12(1 row)
 13
 14Query 20211105_070156_00052_e34b7, FINISHED, 1 node
 15Splits: 84 total, 84 done (100.00%)
 160:03 [6M rows, 567MB] [2.01M rows/s, 189MB/s]
 17
 18presto:default> -- PROMPT Q1.2
 19             -> SELECT SUM(LO_EXTENDEDPRICE*LO_DISCOUNT) AS
 20             -> REVENUE
 21             -> FROM  LINEORDER, DATES
 22             -> WHERE  LO_ORDERDATE = D_DATEKEY
 23             -> AND D_YEARMONTH = 'Jan1994'
 24             -> AND LO_DISCOUNT BETWEEN 4 AND 6
 25             -> AND LO_QUANTITY BETWEEN  26 AND 35;
 26 REVENUE 
 27---------
 28 NULL    
 29(1 row)
 30
 31Query 20211105_070205_00053_e34b7, FINISHED, 1 node
 32Splits: 84 total, 84 done (100.00%)
 330:02 [6M rows, 567MB] [2.84M rows/s, 268MB/s]
 34
 35presto:default> -- PROMPT Q1.3
 36             -> SELECT SUM(LO_EXTENDEDPRICE*LO_DISCOUNT) AS
 37             -> REVENUE
 38             -> FROM  LINEORDER, DATES
 39             -> WHERE  LO_ORDERDATE = D_DATEKEY
 40             -> AND D_WEEKNUMINYEAR = 6
 41             -> AND D_YEAR = 1994
 42             -> AND LO_DISCOUNT BETWEEN  5 AND 7
 43             -> AND LO_QUANTITY BETWEEN  26 AND 35;
 44 REVENUE 
 45---------
 46 NULL    
 47(1 row)
 48
 49Query 20211105_070216_00055_e34b7, FINISHED, 1 node
 50Splits: 84 total, 84 done (100.00%)
 510:02 [6M rows, 567MB] [2.55M rows/s, 241MB/s]
 52
 53presto:default> -- PROMPT Q2.1
 54             -> SELECT SUM(LO_REVENUE), D_YEAR, P_BRAND
 55             -> FROM LINEORDER, DATES, PART, SUPPLIER
 56             -> WHERE  LO_ORDERDATE = D_DATEKEY
 57             -> AND LO_PARTKEY = P_PARTKEY
 58             -> AND LO_SUPPKEY = S_SUPPKEY
 59             -> AND P_CATEGORY = 'MFGR#12'
 60             -> AND S_REGION = 'AMERICA'
 61             -> GROUP BY D_YEAR, P_BRAND
 62             -> ORDER BY D_YEAR, P_BRAND;
 63 _col0 | D_YEAR | P_BRAND 
 64-------+--------+---------
 65(0 rows)
 66
 67Query 20211105_070224_00056_e34b7, FINISHED, 1 node
 68Splits: 215 total, 215 done (100.00%)
 690:05 [6.21M rows, 584MB] [1.37M rows/s, 128MB/s]
 70
 71presto:default> -- PROMPT Q2.2
 72             -> SELECT SUM(LO_REVENUE), D_YEAR, P_BRAND
 73             -> FROM LINEORDER, DATES, PART, SUPPLIER
 74             -> WHERE  LO_ORDERDATE = D_DATEKEY
 75             -> AND LO_PARTKEY = P_PARTKEY
 76             -> AND LO_SUPPKEY = S_SUPPKEY
 77             -> AND P_BRAND BETWEEN  'MFGR#2221'
 78             -> AND 'MFGR#2228'
 79             -> AND S_REGION = 'ASIA'
 80             -> GROUP BY D_YEAR, P_BRAND
 81             -> ORDER BY D_YEAR, P_BRAND;
 82 _col0 | D_YEAR | P_BRAND 
 83-------+--------+---------
 84(0 rows)
 85
 86Query 20211105_070519_00065_e34b7, FINISHED, 1 node
 87Splits: 215 total, 215 done (100.00%)
 880:03 [6.21M rows, 584MB] [2.23M rows/s, 210MB/s]
 89
 90presto:default> -- PROMPT Q2.3
 91             -> SELECT SUM(LO_REVENUE), D_YEAR, P_BRAND
 92             -> FROM LINEORDER, DATES, PART, SUPPLIER
 93             -> WHERE  LO_ORDERDATE = D_DATEKEY
 94             -> AND LO_PARTKEY = P_PARTKEY
 95             -> AND LO_SUPPKEY = S_SUPPKEY
 96             -> AND P_BRAND= 'MFGR#2239'
 97             -> AND S_REGION = 'EUROPE'
 98             -> GROUP BY D_YEAR, P_BRAND
 99             -> ORDER BY D_YEAR, P_BRAND;
100 _col0 | D_YEAR | P_BRAND 
101-------+--------+---------
102(0 rows)
103
104Query 20211105_070230_00057_e34b7, FINISHED, 1 node
105Splits: 215 total, 215 done (100.00%)
1060:04 [6.21M rows, 584MB] [1.72M rows/s, 162MB/s]
107
108presto:default> -- PROMPT Q3.1
109             -> SELECT C_NATION, S_NATION, D_YEAR,
110             -> SUM(LO_REVENUE)  AS  REVENUE
111             -> FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
112             -> WHERE  LO_CUSTKEY = C_CUSTKEY
113             -> AND LO_SUPPKEY = S_SUPPKEY
114             -> AND  LO_ORDERDATE = D_DATEKEY
115             -> AND C_REGION = 'ASIA'
116             -> AND S_REGION = 'ASIA'
117             -> AND D_YEAR >= 1992 AND D_YEAR <= 1997
118             -> GROUP BY C_NATION, S_NATION, D_YEAR
119             -> ORDER BY D_YEAR ASC,  REVENUE DESC;
120 C_NATION | S_NATION | D_YEAR | REVENUE 
121----------+----------+--------+---------
122(0 rows)
123
124Query 20211105_070237_00058_e34b7, FINISHED, 1 node
125Splits: 215 total, 215 done (100.00%)
1260:04 [6.04M rows, 570MB] [1.48M rows/s, 140MB/s]
127
128presto:default> -- PROMPT Q3.2
129             -> SELECT C_CITY, S_CITY, D_YEAR, SUM(LO_REVENUE)
130             -> AS  REVENUE
131             -> FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
132             -> WHERE  LO_CUSTKEY = C_CUSTKEY
133             -> AND LO_SUPPKEY = S_SUPPKEY
134             -> AND  LO_ORDERDATE = D_DATEKEY
135             -> AND C_NATION = 'UNITED STATES'
136             -> AND S_NATION = 'UNITED STATES'
137             -> AND D_YEAR >= 1992 AND D_YEAR <= 1997
138             -> GROUP BY C_CITY, S_CITY, D_YEAR
139             -> ORDER BY D_YEAR ASC,  REVENUE DESC;
140 C_CITY | S_CITY | D_YEAR | REVENUE 
141--------+--------+--------+---------
142(0 rows)
143
144Query 20211105_070246_00059_e34b7, FINISHED, 1 node
145Splits: 215 total, 215 done (100.00%)
1460:04 [6.04M rows, 570MB] [1.7M rows/s, 161MB/s]
147
148presto:default> -- PROMPT Q3.3
149             -> SELECT C_CITY, S_CITY, D_YEAR, SUM(LO_REVENUE)
150             -> AS  REVENUE
151             -> FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
152             -> WHERE  LO_CUSTKEY = C_CUSTKEY
153             -> AND LO_SUPPKEY = S_SUPPKEY
154             -> AND  LO_ORDERDATE = D_DATEKEY
155             -> AND  (C_CITY='UNITED KI1'
156             -> OR C_CITY='UNITED KI5')
157             -> AND (S_CITY='UNITED KI1'
158             -> OR S_CITY='UNITED KI5')
159             -> AND D_YEAR >= 1992 AND D_YEAR <= 1997
160             -> GROUP BY C_CITY, S_CITY, D_YEAR
161             -> ORDER BY D_YEAR ASC,  REVENUE DESC;
162 C_CITY | S_CITY | D_YEAR | REVENUE 
163--------+--------+--------+---------
164(0 rows)
165
166Query 20211105_070252_00060_e34b7, FINISHED, 1 node
167Splits: 215 total, 215 done (100.00%)
1680:03 [6.04M rows, 570MB] [1.86M rows/s, 175MB/s]
169
170presto:default> -- PROMPT Q3.4
171             -> SELECT C_CITY, S_CITY, D_YEAR, SUM(LO_REVENUE)
172             -> AS  REVENUE
173             -> FROM CUSTOMER, LINEORDER, SUPPLIER, DATES
174             -> WHERE  LO_CUSTKEY = C_CUSTKEY
175             -> AND LO_SUPPKEY = S_SUPPKEY
176             -> AND  LO_ORDERDATE = D_DATEKEY
177             -> AND  (C_CITY='UNITED KI1'
178             -> OR C_CITY='UNITED KI5')
179             -> AND (S_CITY='UNITED KI1'
180             -> OR S_CITY='UNITED KI5')
181             -> AND D_YEARMONTH = 'Dec1997'
182             -> GROUP BY C_CITY, S_CITY, D_YEAR
183             -> ORDER BY D_YEAR ASC,  REVENUE DESC;
184 C_CITY | S_CITY | D_YEAR | REVENUE 
185--------+--------+--------+---------
186(0 rows)
187
188Query 20211105_070259_00061_e34b7, FINISHED, 1 node
189Splits: 215 total, 215 done (100.00%)
1900:03 [6.04M rows, 570MB] [1.82M rows/s, 172MB/s]
191
192presto:default> -- PROMPT Q4.1
193             -> SELECT D_YEAR, C_NATION,
194             -> SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT
195             -> FROM DATES, CUSTOMER, SUPPLIER, PART, LINEORDER
196             -> WHERE  LO_CUSTKEY = C_CUSTKEY
197             -> AND LO_SUPPKEY = S_SUPPKEY
198             -> AND LO_PARTKEY = P_PARTKEY
199             -> AND  LO_ORDERDATE = D_DATEKEY
200             -> AND C_REGION = 'AMERICA'
201             -> AND S_REGION = 'AMERICA'
202             -> AND (P_MFGR = 'MFGR#1'
203             -> OR P_MFGR = 'MFGR#2')
204             -> GROUP BY D_YEAR, C_NATION
205             -> ORDER BY D_YEAR, C_NATION;
206 D_YEAR | C_NATION | PROFIT 
207--------+----------+--------
208(0 rows)
209
210Query 20211105_070305_00062_e34b7, FINISHED, 1 node
211Splits: 264 total, 264 done (100.00%)
2120:04 [6.24M rows, 586MB] [1.53M rows/s, 143MB/s]
213
214presto:default> -- PROMPT Q4.2
215             -> SELECT D_YEAR, S_NATION, P_CATEGORY,
216             -> SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT
217             -> FROM DATES, CUSTOMER, SUPPLIER, PART, LINEORDER
218             -> WHERE  LO_CUSTKEY = C_CUSTKEY
219             -> AND LO_SUPPKEY = S_SUPPKEY
220             -> AND LO_PARTKEY = P_PARTKEY
221             -> AND  LO_ORDERDATE = D_DATEKEY
222             -> AND C_REGION = 'AMERICA'
223             -> AND S_REGION = 'AMERICA'
224             -> AND (D_YEAR = 1997 OR D_YEAR = 1998)
225             -> AND (P_MFGR = 'MFGR#1'
226             -> OR P_MFGR = 'MFGR#2')
227             -> GROUP BY D_YEAR, S_NATION, P_CATEGORY
228             -> ORDER BY D_YEAR, S_NATION, P_CATEGORY;
229 D_YEAR | S_NATION | P_CATEGORY | PROFIT 
230--------+----------+------------+--------
231(0 rows)
232
233Query 20211105_070311_00063_e34b7, FINISHED, 1 node
234Splits: 264 total, 264 done (100.00%)
2350:04 [6.24M rows, 586MB] [1.69M rows/s, 159MB/s]
236
237presto:default> -- PROMPT Q4.3
238             -> SELECT D_YEAR, S_CITY, P_BRAND,
239             -> SUM(LO_REVENUE - LO_SUPPLYCOST) AS PROFIT
240             -> FROM DATES, CUSTOMER, SUPPLIER, PART, LINEORDER
241             -> WHERE  LO_CUSTKEY = C_CUSTKEY
242             -> AND LO_SUPPKEY = S_SUPPKEY
243             -> AND LO_PARTKEY = P_PARTKEY
244             -> AND  LO_ORDERDATE = D_DATEKEY
245             -> AND S_NATION = 'UNITED STATES'
246             -> AND (D_YEAR = 1997 OR D_YEAR = 1998)
247             -> AND P_CATEGORY = 'MFGR#14'
248             -> GROUP BY D_YEAR, S_CITY, P_BRAND
249             -> ORDER BY D_YEAR, S_CITY, P_BRAND;
250 D_YEAR | S_CITY | P_BRAND | PROFIT 
251--------+--------+---------+--------
252(0 rows)
253
254Query 20211105_070319_00064_e34b7, FINISHED, 1 node
255Splits: 264 total, 264 done (100.00%)
2560:04 [6.24M rows, 586MB] [1.78M rows/s, 167MB/s]
下一页
上一页

相关