[MDEV-13628] ORed condition in pushed index condition is not removed from the WHERE Created: 2017-08-23 Updated: 2019-05-13 Resolved: 2019-05-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.1, 10.2, 10.3 |
| Fix Version/s: | 10.4.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Description |
|
Noticed this when working on MyRocks but it seems to be an issue affecting any storage engine:
Note that index_condition and attached_condition have the same condition. This should not happen, the optimizer should try to remove the condition that is already checked. FB/mysql does it, and MariaDB's one should, too. ( We should check the revision history - did this got broken un-intentionally?) The storage engine doesn't matter:
|
| Comments |
| Comment by Varun Gupta (Inactive) [ 2017-08-31 ] | |||||
|
Have checked the history of 10.1 where analyze was introduced, the above issue was there in all the versions of 10.1 | |||||
| Comment by Sergei Petrunia [ 2017-09-01 ] | |||||
|
However, index condition pushdown was there before the ANALYZE, and this bug is about ICP ( ANALYZE, or actually FORMAT=JSON only provides a way to view the condition for the user). | |||||
| Comment by Sergei Petrunia [ 2017-09-13 ] | |||||
|
If I take MariaDB and roll it back to the revision d9a81475c70aebc1f2542bf0c115b3ebd9649193 , I can see there:
this is exactly the piece of code that the patch wants to add. I'm wondering on what occasion it was removed? | |||||
| Comment by Sergei Petrunia [ 2017-09-13 ] | |||||
|
This is the commit that removed it: | |||||
| Comment by Sergei Petrunia [ 2017-09-13 ] | |||||
|
... and that commit says:
So the current patch is trying to do just that: assume that make_cond_for_table (I assume Igor has meant make_cond_for_index here) leaves the value of ICP_COND_USES_INDEX_ONLY in sub-condition markers. Let's discuss this with Igor. | |||||
| Comment by Sergei Petrunia [ 2017-10-03 ] | |||||
|
Got a question: http://lists.askmonty.org/pipermail/commits/2017-September/011501.html Need to investigate this before we can proceed. | |||||
| Comment by Varun Gupta (Inactive) [ 2017-10-03 ] | |||||
|
psergey | |||||
| Comment by Varun Gupta (Inactive) [ 2018-07-19 ] | |||||
|
New patch with lots of result files updated (which were incorrectly updated earlier) http://lists.askmonty.org/pipermail/commits/2018-July/012710.html | |||||
| Comment by Igor Babaev [ 2019-05-02 ] | |||||
|
Varun, | |||||
| Comment by Varun Gupta (Inactive) [ 2019-05-06 ] | |||||
|
The fix version is decided as 10.4 and this can be back-ported to earlier versions if requested | |||||
| Comment by Varun Gupta (Inactive) [ 2019-05-06 ] | |||||
|
Patch |