TiDB does not support loose index scan #14460
Labels
feature/accepted
This feature request is accepted by product managers
priority/P2
The issue has P2 priority.
sig/planner
SIG: Planner
type/feature-request
Categorizes issue or PR as related to a new feature.
type/performance
Feature Request
Is your feature request related to a problem? Please describe:
I have been looking into edge cases where TiDB could perform significantly worse than MySQL, which causes regressions for applications migrating. Consider the following test case:
Describe the feature you'd like:
In MySQL the select distinct is considerably faster. Using MySQL 8.0.18 with EXPLAIN ANALYZE:
The optimization loose index scan is applying here. Because the key
b
is low cardinality, it scans it in a way that repositions the pointer after each row is read to find rows > that value. Thus, only 8 rows needed to be read from the table.Executing the two queries in TiDB shows that there is very little difference between them:
Describe alternatives you've considered:
There was one previous mention of loose index scan in #5896
I do not have a specific use-case in mind yet, which may have alternative fixes to loose-index-scan. This was discovered in generic research into potential regressions.
Teachability, Documentation, Adoption, Migration Strategy:
I think it would help to document particular cases where TiDB may be much slower, this being one of them. With work being done on index merge.. there should not be very many of them.
The text was updated successfully, but these errors were encountered: