-
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
global index: specify the table partition, but return all partitions' rows #40497
Comments
I want to contribute this issue, and I have two solutions:
Which solution is better in your opinion? @tiancaiamao |
I analyze the global index code logic, it seems global index would ignore partition table related logic in executorBuilder.buildIndexLookUpReader. |
This is viable, let the index scan filter out the result belong to partition(p0) |
@tiancaiamao I pull the request, please review it. |
In master aa51b46 it does not select the index access, but table scan and gives correct result:
Note that to test this one needs to enable global index (which is not yet supported). Either by config file (adding |
@mjonss I find the fix PR: "planner, executor: fix query partition table with global unique index get wrong result (#22478)". The logic is not comfortable for me, as global index hint would be ignored for all situations, and tableFullScan is less efficient. I still have the following questions:
|
@mjonss master doesn't solve the problem actually, because it ignore the global index in |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
when execturing the query: select * from p partition(p0) use index (idx)
the result should be: "1 3"
3. What did you see instead (Required)
[”1 3“, ”3 4“, ”5 6“, "7 9"]
4. What is your TiDB version? (Required)
version: release-5.0
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v5.0.0-414-g6ca79c09c3-dirty
Edition: Community
Git Commit Hash: 6ca79c09c34ecbda1a49a961c049b477eb8f6a65
UTC Build Time: 2023-01-10 08:47:50
GoVersion: go1.16.10
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.77 sec)
The text was updated successfully, but these errors were encountered: