Bug #88817 | Field or reference of SELECT #2 was resolved in SELECT #1 | ||
---|---|---|---|
Submitted: | 7 Dec 2017 14:26 | Modified: | 19 Jan 2018 11:17 |
Reporter: | Christoffer Lindberg | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.7.17 | OS: | Linux (AWS RDS) |
Assigned to: | CPU Architecture: | Any | |
Tags: | explain, reference, subquery, warning |
[7 Dec 2017 14:26]
Christoffer Lindberg
[8 Dec 2017 8:26]
Øystein Grøvlen
The "warnings" is the Notes that before 5.7 was only shown when doing EXPLAIN EXTENDED. In 5.7, EXPLAIN works as EXPLAIN EXTENDED and EXPLAIN EXTENDED has been deprecated. These notes gives additional information about the query plan, and do not indicate that there is anything wrong about the query. If you do not want to be warned about notes, you can set sql_notes=0: mysql> warnings; Show warnings enabled. mysql> EXPLAIN SELECT n.id, (SELECT email FROM users u WHERE u.id = n.author_user_id) AS author_email FROM news n LIMIT 10; +----+--------------------+-------+------------+--------+---------------+----------------+---------+-----------------------+------+----------+-------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+--------------------+-------+------------+--------+---------------+----------------+---------+-----------------------+------+----------+-------------+ | 1 | PRIMARY | n | NULL | index | NULL | author_user_id | 4 | NULL | 1 | 100.00 | Using index | | 2 | DEPENDENT SUBQUERY | u | NULL | eq_ref | PRIMARY | PRIMARY | 4 | test.n.author_user_id | 1 | 100.00 | NULL | +----+--------------------+-------+------------+--------+---------------+----------------+---------+-----------------------+------+----------+-------------+ 2 rows in set, 2 warnings (0,00 sec) Note (Code 1276): Field or reference 'test.n.author_user_id' of SELECT #2 was resolved in SELECT #1 Note (Code 1003): /* select#1 */ select `test`.`n`.`id` AS `id`,(/* select#2 */ select `test`.`u`.`email` from `test`.`users` `u` where (`test`.`u`.`id` = `test`.`n`.`author_user_id`)) AS `author_email` from `test`.`news` `n` limit 10 mysql> set sql_notes=0; Query OK, 0 rows affected (0,00 sec) mysql> EXPLAIN SELECT n.id, (SELECT email FROM users u WHERE u.id = n.author_user_id) AS author_email FROM news n LIMIT 10; +----+--------------------+-------+------------+--------+---------------+----------------+---------+-----------------------+------+----------+-------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+--------------------+-------+------------+--------+---------------+----------------+---------+-----------------------+------+----------+-------------+ | 1 | PRIMARY | n | NULL | index | NULL | author_user_id | 4 | NULL | 1 | 100.00 | Using index | | 2 | DEPENDENT SUBQUERY | u | NULL | eq_ref | PRIMARY | PRIMARY | 4 | test.n.author_user_id | 1 | 100.00 | NULL | +----+--------------------+-------+------------+--------+---------------+----------------+---------+-----------------------+------+----------+-------------+ 2 rows in set (0,00 sec)
[8 Dec 2017 10:06]
Christoffer Lindberg
Status changed to open.
[19 Jan 2018 11:17]
MySQL Verification Team
Status changed to !bug how was clearly handled by developer.