-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow filter condition push down to IndexScan for prefix index. #21145
Comments
The optimization may cause some correctness problems when new collation is enabled. For example, using #38215, we can get the following wrong result.
|
There are some differences between MySQL and TiDB when handling prefix column. MySQL pads space to prefix length while TiDB trims space. In both implementations we cannot distinguish whether the real value length is less than the index prefix column length. MySQL also needs double scan for |
There are still two optimizations we can do:
|
Is this supported now? Can we also do push down to greater and less than scenario too? |
Feature Request
Allow filter condition push down to IndexScan for prefix index.
The condition
b = 'b'
should be able to pushed down toIndexScan
phase to reduce the lookup table cost.We only need to make sure the equal condition value of
b
is less than the index column length 255.The ideal plan should be
Describe alternatives you've considered:
Teachability, Documentation, Adoption, Migration Strategy:
The text was updated successfully, but these errors were encountered: