Closed
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
create table t(id int, a varchar(100), b int, c int, index idx_ab(a, b));
explain select * from t where c = 10 and (a = 'xx' or (a = 'kk' and b = 1));
2. What did you expect to see? (Required)
mysql> explain select * from t where c = 10 and (a = 'xx' or (a = 'kk' and b = 1));
+-------------------------------+---------+-----------+-----------------------------+--------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------------+---------+-----------+-----------------------------+--------------------------------------------------------------------+
| IndexLookUp_11 | 0.01 | root | | |
| ├─IndexRangeScan_8(Build) | 10.10 | cop[tikv] | table:t, index:idx_ab(a, b) | range:["kk" 1,"kk" 1], ["xx","xx"], keep order:false, stats:pseudo |
| └─Selection_10(Probe) | 0.01 | cop[tikv] | | eq(test.t.c, 10) |
| └─TableRowIDScan_9 | 10.10 | cop[tikv] | table:t | keep order:false, stats:pseudo |
+-------------------------------+---------+-----------+-----------------------------+--------------------------------------------------------------------+
4 rows in set (0.01 sec)
3. What did you see instead (Required)
mysql> explain select * from t where c = 10 and (a = 'xx' or (a = 'kk' and b = 1));
+----------------------------+---------+-----------+-----------------------------+------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+----------------------------+---------+-----------+-----------------------------+------------------------------------------------------------------+
| IndexLookUp_12 | 0.01 | root | | |
| ├─Selection_10(Build) | 0.02 | cop[tikv] | | or(eq(test.t.a, "xx"), and(eq(test.t.a, "kk"), eq(test.t.b, 1))) |
| │ └─IndexRangeScan_8 | 20.00 | cop[tikv] | table:t, index:idx_ab(a, b) | range:["kk","kk"], ["xx","xx"], keep order:false, stats:pseudo |
| └─Selection_11(Probe) | 0.01 | cop[tikv] | | eq(test.t.c, 10) |
| └─TableRowIDScan_9 | 0.02 | cop[tikv] | table:t | keep order:false, stats:pseudo |
+----------------------------+---------+-----------+-----------------------------+------------------------------------------------------------------+
5 rows in set (0.01 sec)
4. What is your TiDB version? (Required)
master
Metadata
Assignees
Labels
This bug affects 5.1.x versions.This bug affects 5.2.x versions.This bug affects 5.3.x versions.This bug affects the 5.4.x(LTS) versions.This bug affects the 6.1.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.SIG: PlannerThe issue is confirmed as a bug.
Activity