[MDEV-15385] Full scan instead of index lookup on single table DELETE ... WHERE IN (SELECT ...) Created: 2018-02-22 Updated: 2023-10-31 Resolved: 2023-10-24 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Delete, Optimizer |
| Affects Version/s: | 10.2.12, 10.3.4 |
| Fix Version/s: | 11.1.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Hartmut Holzgraefe | Assignee: | Sergei Petrunia |
| Resolution: | Duplicate | Votes: | 4 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Description |
|
In the SELECT case the query plan looks fine and the subquery is optimized away into a regular join:
In the DELETE case the subquery is still there, and a full table scan is done on table t1:
Rewriting the DELETE to use the multi table form works as a workaround:
Similar problems can be seen when using a secondary index in the subquery:
See also: https://bugs.mysql.com/35794 |
| Comments |
| Comment by Hartmut Holzgraefe [ 2018-02-22 ] | |||||
|
In
but I can't find any mention of this in the knowledge base, or in any active MDEV | |||||
| Comment by Sergei Petrunia [ 2023-10-24 ] | |||||
|
This is fixed in 11.1 by this commit:
| |||||
| Comment by Sergei Petrunia [ 2023-10-24 ] | |||||
|
Closing as duplicate of |