Bug #69367 | EXPLAIN shows "Scanned 1 database" while the query scans many databases | ||
---|---|---|---|
Submitted: | 31 May 2013 20:32 | Modified: | 31 May 2013 22:55 |
Reporter: | Sergey Petrunya | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Information schema | Severity: | S3 (Non-critical) |
Version: | 5.6 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[31 May 2013 20:32]
Sergey Petrunya
[31 May 2013 20:42]
Sergey Petrunya
fixed synopsis
[31 May 2013 22:55]
MySQL Verification Team
Thank you for the bug report.
[7 Jun 2013 9:46]
Georgi Kodinov
Posted by developer: The problem is in the way EXPLAIN prints the extra column. In explain_extra() function there's the following code : if (table_list->has_db_lookup_value && table_list->has_table_lookup_value) { if (push_extra(ET_SCANNED_DATABASES, "0")) return true; } else if (table_list->has_db_lookup_value || table_list->has_table_lookup_value) { if (push_extra(ET_SCANNED_DATABASES, "1")) return true; } else { if (push_extra(ET_SCANNED_DATABASES, "all")) return true; } The first branch is correct : if there's both table and database lookup it won't scan any databases. But the second branch is bad : if there's a table lookup value it may scan more than 1 database as you're correctly pointing out.