[MDEV-30901] Index usage for DATE(datetime_column) = const does not work for engine Memory Created: 2023-03-22 Updated: 2023-04-25 Resolved: 2023-04-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 11.1 |
| Fix Version/s: | 11.1.1 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Lena Startseva | Assignee: | Oleg Smirnov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
The Memory engine retained the old behavior.
Query plan has:
Example test:
Actual result:
|
| Comments |
| Comment by Oleg Smirnov [ 2023-03-23 ] | ||||||||||||||||||||||||
|
The reason why the condition rewrite doesn't happen is false result of condition check:
which happens here:
item_field->field->part_of_key equals to 0 for the MEMORY engine while it equals to 3 for MyISAM. Field::part_of_key is set here:
Condition
is false for the MEMORY engine which prevents setting field->part_of_key bits. | ||||||||||||||||||||||||
| Comment by Oleg Smirnov [ 2023-03-24 ] | ||||||||||||||||||||||||
|
The fix is pushed into preview-11.1-mdev-8320. | ||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2023-04-13 ] | ||||||||||||||||||||||||
|
using the check for item_field->field->flags & PART_KEY_FLAG will cause the rewite still occur for key parts of indexes that were disabled with IGNORE INDEX hint:
| ||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2023-04-13 ] | ||||||||||||||||||||||||
|
... but that doesn't look significant. Ok to push. | ||||||||||||||||||||||||
| Comment by Oleg Smirnov [ 2023-04-19 ] | ||||||||||||||||||||||||
|
Raising priority to Critical to get into the current release timeline (approved by julien.fritsch). | ||||||||||||||||||||||||
| Comment by Lena Startseva [ 2023-04-24 ] | ||||||||||||||||||||||||
|
Testing done. Ok to push | ||||||||||||||||||||||||
| Comment by Oleg Smirnov [ 2023-04-25 ] | ||||||||||||||||||||||||
|
Pushed to 11.1 |