Bug #48134 | EXPLAIN EXTENDED + SHOW WARNINGS not executable | ||
---|---|---|---|
Submitted: | 18 Oct 2009 12:48 | Modified: | 14 May 2012 17:38 |
Reporter: | Peter Laursen (Basic Quality Contributor) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S2 (Serious) |
Version: | 5.1.39, 5.1.41, 5.4.3 | OS: | Any |
Assigned to: | Paul DuBois | CPU Architecture: | Any |
Tags: | qc |
[18 Oct 2009 12:48]
Peter Laursen
[18 Oct 2009 12:54]
Peter Laursen
If it matters I am using the built-in InnoDB - not the plugin.
[18 Oct 2009 15:01]
Valeriy Kravchuk
I had verified that your example #1 had produced some code that is not executable "as is": mysql> explain extended SELECT id FROM child WHERE pointsout IN (SELECT id FROM parent)\G *************************** 1. row *************************** id: 1 select_type: PRIMARY table: child type: index possible_keys: NULL key: FK_child key_len: 5 ref: NULL rows: 1 filtered: 100.00 Extra: Using where; Using index *************************** 2. row *************************** id: 2 select_type: DEPENDENT SUBQUERY table: parent type: unique_subquery possible_keys: PRIMARY key: PRIMARY key_len: 4 ref: func rows: 1 filtered: 100.00 Extra: Using index 2 rows in set, 1 warning (0.36 sec) mysql> show warnings\G *************************** 1. row *************************** Level: Note Code: 1003 Message: select `test`.`child`.`id` AS `id` from `test`.`child` where <in_optimizer>(`test`.`child`.`pointsout`,<exists>(<primary_index_lookup>(<cache>(`test`.`child`.`pointsout`) in parent on PRIMARY))) 1 row in set (0.00 sec) mysql> select `test`.`child`.`id` AS `id` from `test`.`child` where <in_optimizer>(`test`.`child`.`pointsout`,<exists>(<primary_index_lookup>(<cache>(`test`.`child`.`pointsout`) in parent on PRIMARY))); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<in_optimizer>(`test`.`child`.`pointsout`,<exists>(<primary_index_lookup>(<cache' at line 1 But I do *not* see any text in the manual that claims that the results of SHOW WARNINGS after EXPLAIN EXTENDED should be always executable as is. So, this is the feature request at best.
[18 Oct 2009 15:02]
Peter Laursen
Also neither LEFT JOIN or RIGHT JOIN will return such <symbolics>. However http://dev.mysql.com/doc/refman/5.1/en/using-explain.html says "EXPLAIN EXTENDED also displays the filtered column as of MySQL 5.1.12." .. but if this is the meaning of this passage I really request an elaboration of * when such <symbolics> occur * the exact meaning of each
[18 Oct 2009 15:18]
Peter Laursen
Maybe it is a feature request but there is no information about when such occur and what every possible <symbolics> exactly mean. It looks too much like a 'hack' to me. At least this should be documented to the same degree as the 'extra' column in plain EXPLAIN. But I would prefer a 'clean' output telling what is actually executed in an executable form. If I strip the <symbolics> it does not execute (and then of course /*comment*/ could have been used instead). Anyway .. the optimizer team probably has something to say here too!
[18 Oct 2009 15:31]
Valeriy Kravchuk
I agree that all these: <exists> <primary_index_lookup> <cache> and other terms of EXPLAIN EXTENDED results should be explained in the manual.
[18 Oct 2009 16:06]
Peter Laursen
Also a subquery in the FROM clause does not use such <symbolics>: example: SELECT child.id, derived.id FROM child, (SELECT * FROM parent) AS derived; Optimized: select `fktest`.`child`.`id` AS `id`, '0' AS `id` from `fktest`.`child` join (select `fktest`.`parent`.`id` AS `id`, `fktest`.`parent`.`blah` AS `blah` from `fktest`.`parent`) `derived`
[18 Oct 2009 16:57]
Peter Laursen
Actually I request a little more than that. *is this intended behaviour? *except for WHERE IN what other constructions are affected? I would find it fine if 'hints' were added as /*comments*/ inside an executabel statement, but I still do no see why one particular statement should be affected (ie. returning non-executable statement) as almost identical statements are not. So I do not necessarily agree with reclassification from 'optimizer' to 'docs'. But anyway, let optimizer team explain!
[11 Mar 2010 15:55]
Paul DuBois
Will be covered by WL#5144.
[14 May 2012 17:38]
Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products. http://dev.mysql.com/doc/refman/5.5/en/explain-extended.html: " Because the statement produced as output may contain special markers to provide information about query rewriting or optimizer actions, the statement is not necessarily valid SQL and is not intended to be executed. "