2.3 速度测试
localhost :) SELECT
:-] C_CITY,
:-] S_CITY,
:-] toYear(LO_ORDERDATE) AS year,
:-] sum(LO_REVENUE) AS revenue
:-] FROM lineorder_flat
:-] WHERE (C_CITY = 'UNITED KI1' OR C_CITY = 'UNITED KI5') AND (S_CITY = 'UNITED KI1' OR S_CITY = 'UNITED KI5') AND year >= 1992 AND year <= 1997
:-] GROUP BY
:-] C_CITY,
:-] S_CITY,
:-] year
:-] ORDER BY
:-] year ASC,
:-] revenue DESC;
SELECT
C_CITY,
S_CITY,
toYear(LO_ORDERDATE) AS year,
sum(LO_REVENUE) AS revenue
FROM lineorder_flat
WHERE ((C_CITY = 'UNITED KI1') OR (C_CITY = 'UNITED KI5')) AND ((S_CITY = 'UNITED KI1') OR (S_CITY = 'UNITED KI5')) AND (year >= 1992) AND (year <= 1997)
GROUP BY
C_CITY,
S_CITY,
year
ORDER BY
year ASC,
revenue DESC
┌─C_CITY─────┬─S_CITY─────┬─year─┬────revenue─┐
│ UNITED KI1 │ UNITED KI1 │ 1992 │ 5776096629 │
│ UNITED KI5 │ UNITED KI1 │ 1992 │ 5555883901 │
│ UNITED KI5 │ UNITED KI5 │ 1992 │ 5348705805 │
│ UNITED KI1 │ UNITED KI5 │ 1992 │ 5326870427 │
│ UNITED KI1 │ UNITED KI1 │ 1993 │ 5892974670 │
│ UNITED KI1 │ UNITED KI5 │ 1993 │ 5490859451 │
│ UNITED KI5 │ UNITED KI1 │ 1993 │ 5468354303 │
│ UNITED KI5 │ UNITED KI5 │ 1993 │ 5089909647 │
│ UNITED KI5 │ UNITED KI1 │ 1994 │ 5437315108 │
│ UNITED KI1 │ UNITED KI1 │ 1994 │ 5348775917 │
│ UNITED KI5 │ UNITED KI5 │ 1994 │ 5310936695 │
│ UNITED KI1 │ UNITED KI5 │ 1994 │ 5237461110 │
│ UNITED KI1 │ UNITED KI1 │ 1995 │ 5737551920 │
│ UNITED KI5 │ UNITED KI5 │ 1995 │ 5657584590 │
│ UNITED KI5 │ UNITED KI1 │ 1995 │ 5260093556 │
│ UNITED KI1 │ UNITED KI5 │ 1995 │ 5213763257 │
│ UNITED KI5 │ UNITED KI1 │ 1996 │ 5522325005 │
│ UNITED KI1 │ UNITED KI1 │ 1996 │ 5451244409 │
│ UNITED KI5 │ UNITED KI5 │ 1996 │ 5231759057 │
│ UNITED KI1 │ UNITED KI5 │ 1996 │ 5203962897 │
│ UNITED KI1 │ UNITED KI1 │ 1997 │ 5340760807 │
│ UNITED KI5 │ UNITED KI1 │ 1997 │ 5295685214 │
│ UNITED KI1 │ UNITED KI5 │ 1997 │ 5188428156 │
│ UNITED KI5 │ UNITED KI5 │ 1997 │ 5024634475 │
└────────────┴────────────┴──────┴────────────┘
24 rows in set. Elapsed: 1.723 sec. Processed 546.67 million rows, 4.46 GB (317.28 million rows/s., 2.59 GB/s.)
扫描 1.7 秒处理 546w 的数据量,每秒处理 317w 行数据,速度是相当快了。