[MDEV-7982] EXPLAIN shows meaningless query plan with Distinct Created: 2015-04-13 Updated: 2016-04-17 Resolved: 2016-04-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.0.17, 5.3.13, 5.5, 10.1 |
| Fix Version/s: | 10.2.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | explain, verified | ||
| Attachments: |
|
| Description |
|
Take the attached dataset and run this query:
and see an apparently non-sensical output (how can a table use "Distinct" if it This is repeatable on 10.0.17, didn't check 5.5 |
| Comments |
| Comment by Sergei Petrunia [ 2015-04-13 ] | ||||||||||||
|
Debugging on 10.0, looking at this line of code in JOIN::save_explain_data_intern:
select_list_used_tables==0 when we come here... which is weird, JOIN::optimize_inner does call JOIN::eval_select_list_used_tables which should have put a correct value there. in eval_select_list_used_tables we have:
One can debate what (count The point is, if we run
then it is obvious that Distinct optimization is not applicable.
but not when one runs
(unless maybe some cases with Loose Scan). | ||||||||||||
| Comment by Elena Stepanova [ 2015-04-13 ] | ||||||||||||
|
On 5.3 and 5.5, it looks like this:
| ||||||||||||
| Comment by Sergei Petrunia [ 2016-04-17 ] | ||||||||||||
|
This is fixed in 10.2 tree by post- |