select * from orders where (customer_num = 104 and order_num > 1001) or order_num = 1008
雖然在customer和order上面建立了索引蕴掏,但是上面的語句中優(yōu)化器還是使用順序存取路徑掃描整個(gè)表凛忿,應(yīng)該為如下:
select * from orders where customer_num = 104 and order_num > 1001
UNION
select * from orders where order_num = 1008