阅读背景:

SQL联合查询优化 用union all来代替union

来源:互联网 

Optimizing UNION
UNION has an interesting optimization that exists across a few different databases. It's obvious when you think about how it works. UNION gives you the rows from two tables that don't exist in the other. So implicitly, you are removing duplicates. To do this the MySQL database must return distinct rows, and thus must sort the data. Sorting, as we know is expensive, especially for large tables.UNION has an interesting optim




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: