-1
我的嘗試是加入客戶和訂單表並加入lineitem和訂單表。我也索引了c_mktsegment字段。我最後的查詢是這樣的。我能做些什麼來改善它嗎?改善mysql查詢?
select
o_shippriority,
l_orderkey,
o_orderdate,
sum(l_extendedprice * (1 - l_discount)) as revenue
from
cust As c
join ord As o on c.c_custkey = o.o_custkey
join line As l on o.o_orderkey = l.l_orderkey
where
c_mktsegment = ':1'
and o_orderdate < date ':2'
and l_shipdate > date ':2'
group by
l_orderkey,
o_orderdate,
o_shippriority
order by
revenue desc,
o_orderdate;
它有什麼問題? – Cylindric
這可能應該移到http://codereview.stackexchange.com/ – Sirko