Bug #107292 | Index isn't used for order if some primary key columns specified in index | ||
---|---|---|---|
Submitted: | 14 May 2022 0:37 | Modified: | 14 May 2022 13:16 |
Reporter: | Jayden Navarro | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S5 (Performance) |
Version: | 8.0.21, 5.7, 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[14 May 2022 0:37]
Jayden Navarro
[14 May 2022 13:16]
MySQL Verification Team
Hello Jayden Navarro, Thank you for the report and feedback. regards, Umesh
[17 May 2022 9:46]
huahua xu
1. The optimizer does not build the bitmaps of priamry key parts(set TABLE::const_key_parts bits if key fields are equal to constants in the WHERE condition), when force to use the key `IDX_c1_pk1_c2`. JOIN::optimize->make_join_plan->update_ref_and_keys->add_key_part 2. It is failed to sort order by using the key `IDX_c1_pk1_c2`, because the optimizer cann't take advantage of the feature that the storage engine has the primary key as a suffix to the secondary keys(can not skip any primary key parts that are constants in the WHERE clause). JOIN::optimize->test_skip_sort->test_if_skip_sort_order->test_if_order_by_key