background image
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
| version()
|
+
------------+
| 5.7.15-log |
+
------------+
1 row
in
set
(0.00 sec)、
mysql> explain (
select
id
from
helei
order by
id)
union
all
(
select
id
from
t
where
id=0
order by
id);
+
----+-------------+-------+------------+-------+---------------+-----
---+---------+------+------+----------+-------------+
| id | select_type |
table
| partitions | type
| possible_keys |
key
| key_len | ref
|
rows
| filtered | Extra
|
+
----+-------------+-------+------------+-------+---------------+-----
---+---------+------+------+----------+-------------+
|
1 |
PRIMARY
| helei |
NULL
|
index
|
NULL
| idx_
c1 | 4
|
NULL
| 5212 |
100.00 | Using
index
|
|
2 |
UNION
| t
|
NULL
|
ALL
|
NULL
|
NULL
|
NULL
|
NULL
|
1 |
100.00 | Using
where
|
+
----+-------------+-------+------------+-------+---------------+-----
---+---------+------+------+----------+-------------+
2
rows
in
set
, 1 warning (0.00 sec)
可以看出,在 MySQL5.7 版本中,执行结果如下图所示:
Part2:MariaDB10.1.16
1
[root@HE3 ~]# /usr/
local
/mariadb/bin/mysql -uroot -S /tmp/mariadb.sock