[MDEV-745] LP:770012 - Optimizer chooses a suboptimal plan for a join Created: 2011-04-24 Updated: 2015-11-09 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.2.14, 10.1 |
| Fix Version/s: | 10.1 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Igor Babaev | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
I noticed the following suboptimal choice of the optimizer in mariadb-5.2 (the similar behavior of the optimizer can be found in any version of mariadb or mysql). Frequently the optimizer discards as inferior the plan that To demonstrate the problem I use a standard DBT-3 innodb database of scale factor 10 with one additional index on supplier(s_acctbal). The problem can be demonstrated with the query: For this query the optimizer chooses the plan:
An execution by this plan took mariadb-5.2 about 0.06 sec. However the following alternative plan is better as it took only 0.02 sec
Most probably the optimizer does not take into account that when executing by the alternative plan the server accesses at most 3 pages of the table lineitem. |
| Comments |
| Comment by Rasmus Johansson (Inactive) [ 2011-11-11 ] |
|
Launchpad bug id: 770012 |
| Comment by Elena Stepanova [ 2015-11-09 ] |
|
Plans are still the same on 10.1.8, although execution time (at least on my machine) is not several times different, but maybe 40% better for the second query (it is by no means accurate value) |