background image
2
4
2
5
2
6
2
7
可以看出,在 MySQL5.6 版本中,执行结果如下图所示:
从执行计划来看,是把 helei 表的查询结果和 t 表的查询结果合并在了一张临时表里,然后
输出给客户端。
union all 在 MySQL5.7/MariaDB10.1 下的表现
Part1:MySQL5.7.15
1
2
3
4
5
6
7
8
9
1
0
1
1
1
[root@HE1 ~]# mysql -uroot -p
Enter
password
:
Welcome
to
the MySQL monitor.
Commands
end with
;
or
\g.
Your MySQL
connection
id
is
8
Server version: 5.7.15-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle
and
/
or
its affiliates.
All
rights res
erved.
Oracle
is
a registered trademark
of
Oracle Corporation
and
/
or
its
affiliates. Other names may be trademarks
of
their respective
owners.
Type
'help;'
or
'\h'
for
help. Type
'\c'
to
clear the
current
input st
atement.
mysql>
select
version();
+
------------+