Oracle 5.0 Reference Manual page 1125

Table of Contents

Advertisement

mysql>
EXPLAIN SELECT f1(5);
+----+-------------+-------+------+---------------+------+---------+------+------+----------------+
| id | select_type | table | type | possible_keys | key
+----+-------------+-------+------+---------------+------+---------+------+------+----------------+
|
1 | SIMPLE
+----+-------------+-------+------+---------------+------+---------+------+------+----------------+
1 row in set (0.00 sec)
mysql>
SELECT * FROM t2;
Empty set (0.00 sec)
This is because the
columns of the output. This is also true of the following nested SELECT:
Extra
mysql>
EXPLAIN SELECT NOW() AS a1, (SELECT f1(5)) AS a2;
+----+-------------+-------+------+---------------+------+---------+------+------+----------------+
| id | select_type | table | type | possible_keys | key
+----+-------------+-------+------+---------------+------+---------+------+------+----------------+
|
1 | PRIMARY
+----+-------------+-------+------+---------------+------+---------+------+------+----------------+
1 row in set, 1 warning (0.00 sec)
mysql>
SHOW WARNINGS;
+-------+------+------------------------------------------+
| Level | Code | Message
+-------+------+------------------------------------------+
| Note
| 1249 | Select 2 was reduced during optimization |
+-------+------+------------------------------------------+
1 row in set (0.00 sec)
mysql>
SELECT * FROM t2;
Empty set (0.00 sec)
However, if the outer
subquery as well:
mysql>
EXPLAIN SELECT * FROM t1 AS a1, (SELECT f1(5)) AS a2;
+----+-------------+------------+--------+---------------+------+---------+------+------+--------------
| id | select_type | table
+----+-------------+------------+--------+---------------+------+---------+------+------+--------------
|
1 | PRIMARY
|
1 | PRIMARY
|
2 | DERIVED
+----+-------------+------------+--------+---------------+------+---------+------+------+--------------
3 rows in set (0.00 sec)
mysql>
SELECT * FROM t2;
+------+
| c1
|
+------+
|
5 |
+------+
1 row in set (0.00 sec)
This also means that an
time to execute because the
EXPLAIN SELECT * FROM t1 AS a1, (SELECT BENCHMARK(1000000, MD5(NOW())));
13.2.9.9. Subquery Errors
There are some errors that apply only to subqueries. This section describes them.
• Unsupported subquery syntax:
ERROR 1235 (ER_NOT_SUPPORTED_YET)
SQLSTATE = 42000
Message = "This version of MySQL doesn't yet support
'LIMIT & IN/ALL/ANY/SOME subquery'"
Subquery Syntax
| NULL
| NULL | NULL
statement did not reference any tables, as can be seen in the
SELECT
| NULL
| NULL | NULL
references any tables, the optimizer executes the statement in the
SELECT
| type
| possible_keys | key
| a1
| system | NULL
| <derived2> | system | NULL
| NULL
| NULL
| NULL
statement such as the one shown here may take a long
EXPLAIN SELECT
[957]
BENCHMARK()
1105
| key_len | ref
| NULL | NULL
| NULL | NULL | No tables used |
| key_len | ref
| NULL | NULL
| NULL | NULL | No tables used |
|
| key_len | ref
| NULL | NULL
| NULL | NULL
| NULL | NULL
function is executed once for each row in t1:
| rows | Extra
and
table
| rows | Extra
| rows | Extra
| NULL |
0 | const row not
| NULL |
1 |
| NULL | NULL | No tables use
|
|

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents