1. Union: Set operation on two result sets, go to weight, sort by default rule
2. UNION ALL: Set operation on two result sets, do not go heavy, do not sort
3, Intersect: the intersection of two result sets, go to heavy, sorted by default rules
4, minus: For two result sets of the difference operation, go to heavy, according to the default rules sort
5, or: Meet the two conditions of the set, do not go heavy, do not sort
The following conclusion concludes:
1, if the or field is an indexed field, then use union all instead of or operation, you can walk the index
2, if you can use union all, try not to use union, equivalent to want to distinct and executed the order by
3, the default collation described here is sorted by the order of the fields behind the Select, sorted by first field, sorted by the second field if the first field is the same
"SQL Optimization" union, union all, or use