[MDEV-24413] Combine adjacent "column IN (...)" conditions together Created: 2020-12-15 Updated: 2020-12-15 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Filing this as a followup to the discussion about The idea is to do the following: catch this pattern in the WHERE/ON condition:
and rewrite it as
That is, join the IN-predicates together into one. Do the same for sibling NOT IN (... ) predicates which are part of an AND. The idea is that single IN-list is processed efficiently by the range optimizer, while multiple IN-lists are not. This will work around the problem. The change needs to be performed (TODO: don't recall: late in Prepare stage, or the first in the execution stage). Execution stage is better because this is a rewrite. Prepare is better because we can make destructive modifications to the IN-lists. |