-
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
Index merge wrongly ignore some predicates of generated column #58476
Labels
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
affects-8.1
This bug affects the 8.1.x(LTS) versions.
affects-8.5
This bug affects the 8.5.x(LTS) versions.
fuzz/randomtest
impact/wrong-result
severity/major
sig/planner
SIG: Planner
type/bug
The issue is confirmed as a bug.
Comments
mysql> explain SELECT /*+ USE_INDEX_MERGE(`t3`)*/ id FROM `t3` WHERE c2 BETWEEN 'a' AND 'b' GROUP BY id HAVING id < 100 or id > 0;
+------------------------------------+---------+-----------+------------------------+---------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+------------------------------------+---------+-----------+------------------------+---------------------------------------------------------------------------------------+
| Projection_7 | 0.02 | root | | test.t3.id |
| └─Projection_14 | 1.00 | root | | test.t3.id, test.t3.c2 |
| └─IndexMerge_12 | 1.00 | root | | type: union |
| ├─IndexRangeScan_9(Build) | 1.00 | cop[tikv] | table:t3, index:id(id) | range:[-inf,100), keep order:false, stats:partial[id:unInitialized, c2:unInitialized] |
| ├─TableRangeScan_10(Build) | 1.00 | cop[tikv] | table:t3 | range:(0,+inf], keep order:false, stats:partial[id:unInitialized, c2:unInitialized] |
| └─TableRowIDScan_11(Probe) | 1.00 | cop[tikv] | table:t3 | keep order:false, stats:partial[id:unInitialized, c2:unInitialized] |
+------------------------------------+---------+-----------+------------------------+---------------------------------------------------------------------------------------+
6 rows in set (0.00 sec)
mysql> explain SELECT /*+ USE_INDEX_MERGE(`t3`)*/ id FROM `t3` WHERE c1 BETWEEN 'a' AND 'b' GROUP BY id HAVING id < 100 or id > 0;
+----------------------------------+---------+-----------+------------------------+---------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+----------------------------------+---------+-----------+------------------------+---------------------------------------------------------------------------------------+
| Projection_7 | 0.02 | root | | test.t3.id |
| └─IndexMerge_13 | 1.00 | root | | type: union |
| ├─IndexRangeScan_9(Build) | 1.00 | cop[tikv] | table:t3, index:id(id) | range:[-inf,100), keep order:false, stats:partial[id:unInitialized, c1:unInitialized] |
| ├─TableRangeScan_10(Build) | 1.00 | cop[tikv] | table:t3 | range:(0,+inf], keep order:false, stats:partial[id:unInitialized, c1:unInitialized] |
| └─Selection_12(Probe) | 1.00 | cop[tikv] | | ge(test.t3.c1, "a"), le(test.t3.c1, "b") |
| └─TableRowIDScan_11 | 1.00 | cop[tikv] | table:t3 | keep order:false, stats:partial[id:unInitialized, c1:unInitialized] |
+----------------------------------+---------+-----------+------------------------+---------------------------------------------------------------------------------------+
6 rows in set (0.00 sec) From the plan we can see that the condition |
ti-chi-bot
bot
added
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.1
may-affects-6.5
may-affects-7.1
may-affects-7.5
may-affects-8.1
may-affects-8.5
labels
Dec 24, 2024
13 tasks
hawkingrei
added
affects-8.1
This bug affects the 8.1.x(LTS) versions.
type/bug
The issue is confirmed as a bug.
fuzz/randomtest
and removed
type/bug
The issue is confirmed as a bug.
severity/major
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.1
may-affects-6.5
may-affects-7.1
may-affects-7.5
fuzz/randomtest
may-affects-8.1
impact/wrong-result
affects-8.5
This bug affects the 8.5.x(LTS) versions.
labels
Dec 24, 2024
ti-chi-bot
bot
added
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.1
may-affects-6.5
may-affects-7.1
may-affects-7.5
may-affects-8.5
labels
Dec 24, 2024
hawkingrei
added
impact/wrong-result
sig/planner
SIG: Planner
affects-8.5
This bug affects the 8.5.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-6.5
This bug affects the 6.5.x(LTS) versions.
and removed
may-affects-8.5
may-affects-7.5
may-affects-7.1
may-affects-6.5
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.1
labels
Dec 24, 2024
This was referenced Dec 25, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
affects-8.1
This bug affects the 8.1.x(LTS) versions.
affects-8.5
This bug affects the 8.5.x(LTS) versions.
fuzz/randomtest
impact/wrong-result
severity/major
sig/planner
SIG: Planner
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
Empty set
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: