[MDEV-8361] ORDER BY optimizer doesnt recognize that NL-join produces the desired ordering Created: 2015-06-23 Updated: 2016-01-21 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 5.1.67, 5.2.14, 5.3.12, 5.5, 10.0, 10.1 |
| Fix Version/s: | 10.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | optimizer, order-by-optimization, upstream | ||
| Description |
|
ORDER BY optimizer doesn't recognize that NL-join produces the required ordering. Originally reported here:https://www.facebook.com/MySQLatFacebook/posts/10153059170661696 ,
Plan without ORDER BY:
a1 table uses 'index', so rows are ordered by a1.a, a1.b. Then, ref access returns rows in the order of a2.a, a2.b. (a2.a is also equal to constant). However, test_if_skip_sort_order only looks at one table when determining whether to do sorting. |
| Comments |
| Comment by Jan Lindström (Inactive) [ 2015-06-23 ] | ||||||||||||
|
Index is used if both index columns are provided (note that result is different):
But even first column in primary key :
|