[MDEV-8002] Ability to use index for order-by and covering index changes with type of join to small table Created: 2015-04-15 Updated: 2021-04-29 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.0 |
| Fix Version/s: | 10.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Jiri Kavalik | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | optimizer, order-by-optimization, upstream, verified | ||
| Environment: |
Ubuntu 12.04, CentOS 5.11 |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
In join of 4 tables, optimizer won't use covering index with suitable ordering on first table in case join order of last two tables uses index/table scan on one of them instead of eq_ref - that table has only 2 rows, so optimizer does not seem to feel need to use eq_ref on it, but then resulting plan needs filesort. Happens with and without "LIMIT 3".
Attached is testing dump of 100KB database showing the behavior - on our production server there was one more trouble with plan changing when otherwise unused index is ignored, but I was not able to replicate that on this smaller dataset and I have seen some similar issue already. |
| Comments |
| Comment by Elena Stepanova [ 2015-04-15 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Note: Looks pretty much the same on MySQL 5.6
| |||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-04-15 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Did you check the performance impact on your real-life data? | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Jiri Kavalik [ 2015-04-15 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Last time I checked on MySQL was 5.1.. elenst | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-04-15 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Assigning to psergey for further consideration. | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2020-01-29 ] | |||||||||||||||||||||||||||||||||||||||||||
|
With the ORDER BY LIMIT optimization in MDEV-8306, the plan now pick an ordered index scan.
|