我对此有性能问题union select
(短路):
SELECT
x.a, x.b, x.c, x.d, x.e, x.f, x.g, y.h, y.i
FROM
x
LEFT JOIN y ON ...
UNION
SELECT
c.a, c.b, c.c., c.d, c.e, c.f, c.g, d.h, d.i
FROM
c
LEFT JOIN d ON ...
ORDER BY `ID`, CAST(`X` as UNSIGNED)
查询最多需要一秒钟,正如我所想的那样,因为ORDER BY
. 但是删除ORDER BY
并没有真正的性能提升。
解释看起来像:
有人有想法吗?
为什么这么慢?