-
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
Incorrect results using a prefix index with OR condition #21234
Comments
I originally spotted this in 4.0.8 and was able to reproduce it in master. |
|
the execution plan is: explain select * from t1 where t='0cc175b9c0f1b6a831c399e269772661' or t='92eb5ffee6ae2fec3ad71c777531578f';TiDB(root@127.0.0.1:test) > explain select * from t1 where t='0cc175b9c0f1b6a831c399e269772661' or t='92eb5ffee6ae2fec3ad71c777531578f';
+-------------------------------+---------+-----------+----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------------+---------+-----------+----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| IndexLookUp_11 | 16.00 | root | | |
| ├─IndexRangeScan_8(Build) | 20.00 | cop[tikv] | table:t1, index:t(t) | range:["0cc175b9c0f1b6a831c399e269772661","0cc175b9c0f1b6a831c399e269772661"], ["92eb5ffee6ae2fec3ad71c777531578f","92eb5ffee6ae2fec3ad71c777531578f"], keep order:false, stats:pseudo |
| └─Selection_10(Probe) | 16.00 | cop[tikv] | | or(eq(test.t1.t, "0cc175b9c0f1b6a831c399e269772661"), eq(test.t1.t, "92eb5ffee6ae2fec3ad71c777531578f")) |
| └─TableRowIDScan_9 | 20.00 | cop[tikv] | table:t1 | keep order:false, stats:pseudo |
+-------------------------------+---------+-----------+----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec) I think the range is incorrect for the prefix index |
The result is correct after the statistics for the table are updated, either because of explicit
|
/assign @Reminiscent |
Hm,
|
Do some experiments
|
Please edit this comment or add a new comment to complete the following informationNot a bug
Duplicate bug
BugNote: Make Sure that 'component', and 'severity' labels are added 1. Root Cause Analysis (RCA) (optional)2. Symptom (optional)3. All Trigger Conditions (optional)4. Workaround (optional)5. Affected versions6. Fixed versions |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: