Bug #116268 | if the columns do not form a leftmost prefix of the index can user | ||
---|---|---|---|
Submitted: | 30 Sep 2024 8:16 | Modified: | 30 Sep 2024 15:57 |
Reporter: | yijie fu | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S3 (Non-critical) |
Version: | all | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | if the columns do not form a leftmost prefix of the index can user |
[30 Sep 2024 8:16]
yijie fu
[30 Sep 2024 10:12]
MySQL Verification Team
Hi Mr. fu, Thank you for your bug report. Your example proves that our Documentation is correct. Column `id` is the leftmost prefix of the index, which can be used for index lookups. We do not see how is that description wrong. Not a bug.
[30 Sep 2024 10:32]
yijie fu
order_id is listed in the third column of the index. Theoretically, querying based on the order_id will not go through the index, but "explain" result "key" change the index.
[30 Sep 2024 10:53]
MySQL Verification Team
Hi Mr. fu, That part is also explained in our Reference Manual. Namely, "use index" does not mean that index lookup is used. Not at all !!!!! USE INDEX means that entire index is scanned. That is a totally different algorithm then index lookup. Again, this is all explained in our Reference Manual.
[30 Sep 2024 14:55]
yijie fu
Hi bro: Thank you very much for your answer,but I still have some questions, like the example I gave earlier, using an index but not an index lookup , what algorithm is used to traverse the index tree? Is it a leaf node that performs sequential traversal to scan the entire B+tree?
[30 Sep 2024 14:59]
yijie fu
Just to add, I have read a long document but couldn't find what you said, 'This is all explained in our Reference Manual' Perhaps due to my poor English, I rely entirely on translation software. Thank you again
[30 Sep 2024 15:25]
yijie fu
Another question, does the key_len in explain means "index used" or "index lookup used","Index Condition Pushdown" about this case How to calculate key_len ?
[30 Sep 2024 15:25]
yijie fu
Another question, does the key_len in explain means "index used" or "index lookup used","Index Condition Pushdown" about this case How to calculate key_len ?
[30 Sep 2024 15:36]
MySQL Verification Team
Hi, Entire index is scanned, sequentially in memory ....... Key length should be the entire width of the index used.
[30 Sep 2024 15:57]
yijie fu
Hi : “Key length should be the entire width of the index used.” means “index tuple” sequentially in memory,The length will be recorded in key_len