[MDEV-16225] wrong resultset from query with semijoin=on Created: 2018-05-21 Updated: 2020-08-25 Resolved: 2018-06-02 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer, Server |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3 |
| Fix Version/s: | 5.5.61, 10.0.36, 10.1.34, 10.2.16, 10.3.8 |
| Type: | Bug | Priority: | Major |
| Reporter: | Rick Pizzi | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | semi-join, upstream-not-affected | ||
| Description |
|
Please check the following test case kindly supplied by a customer of ours. This bug is not present in Oracle MySQL 5.6.
|
| Comments |
| Comment by Varun Gupta (Inactive) [ 2018-05-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Output for analyze format=json
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2018-05-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
So after discussion with psergey , we concluded that the eq_ref access on table A should not happen when we have non-semi-join materialisation. This eq_ref access is expected for the IN->EXISTS strategy for the optimisation of non-semi-join subquery. So there is somewhere an A.id = sl.id getting injected and because of that we are made to do the ref access | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2018-05-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
So a way by which the equality can be injected is when we do the IN -> EXIST transformation.
We have a cost based approach to decide which technique should be used. Lets try to run the query with in_to_exists = off
The results are as expected, so IN->EXIST strategy injects A.id = sl.id and then it is not removed when we pick materialisation as the optimum strategy. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2018-05-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Patch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2018-06-02 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Pushed to 5.5 |