[MDEV-30476] EXPLAIN shows ref access, while it should have been eq_ref Created: 2023-01-26 Updated: 2023-01-31 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
I've hit this when doing patch #2 for EXPLAIN in subselect2.result shows "ref|filter":
The nature of the patch hints that this access should have been eq_ref. Debugging, one can see that best_access_path() considers eq_ref on that index.
|
| Comments |
| Comment by Sergei Petrunia [ 2023-01-26 ] | |||||||||||||||||||||||
|
The index in question:
| |||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2023-01-26 ] | |||||||||||||||||||||||
|
This code in create_ref_for_key() considers the index non-unique:
while this code in best_access_path considers the index unique:
| |||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2023-01-26 ] | |||||||||||||||||||||||
|
Patch from Monty extended_keys.diff |