-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Closed
Copy link
Labels
affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.severity/moderatesig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
create table t(a int, b int, c int, primary key(a), key idx(b));
insert into t values (1,1,1),(2,2,2),(3,3,3);
create table t2(a int, primary key(a));
insert into t2 values (1),(2),(3);
create table tp(a int, b int, c int, index ic(c)) partition by range(a) (partition p0 values less than (10),partition p1 values less than (20),partition p2 values less than maxvalue);
insert into tp values (1,1,1),(2,2,2),(13,13,13),(14,14,14),(25,25,25),(36,36,36);
analyze table t;
analyze table t2;
analyze table tp;
explain select * from tp;
explain select * from t1;
explain select * from t2;
set @@tidb_stats_load_sync_wait = 0;
explain format = brief select * from t join tp partition (p0) join t2 where t.a < 10 and t.b = tp.c and t2.a > 10 and t2.a = tp.c;
2. What did you expect to see? (Required)
Correctly display the stats loading related information.
3. What did you see instead (Required)
Note the ID 8:allEvicted
and ID 6:allEvicted
in the plan. The column's ID with incomplete stats is wrong, so it fails to get the column name from the metadata and prints the column ID directly.
+-----------------------------------+---------+-----------+-----------------------+------------------------------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+-----------------------------------+---------+-----------+-----------------------+------------------------------------------------------------------------------------------------------------+
| HashJoin | 0.33 | root | | inner join, equal:[eq(test.tp.c, test.t2.a)] |
| ├─IndexJoin(Build) | 0.33 | root | | inner join, inner:IndexLookUp, outer key:test.t.b, inner key:test.tp.c, equal cond:eq(test.t.b, test.tp.c) |
| │ ├─TableReader(Build) | 0.33 | root | | data:Selection |
| │ │ └─Selection | 0.33 | cop[tikv] | | gt(test.t.b, 10), not(isnull(test.t.b)) |
| │ │ └─TableRangeScan | 1.00 | cop[tikv] | table:t | range:[-inf,10), keep order:false, stats:partial[idx:allEvicted, a:allEvicted, b:allEvicted] |
| │ └─IndexLookUp(Probe) | 0.33 | root | partition:p0 | |
| │ ├─Selection(Build) | 0.33 | cop[tikv] | | gt(test.tp.c, 10), not(isnull(test.tp.c)) |
| │ │ └─IndexRangeScan | 0.50 | cop[tikv] | table:tp, index:ic(c) | range: decided by [eq(test.tp.c, test.t.b)], keep order:false, stats:partial[ID 6:allEvicted] |
| │ └─TableRowIDScan(Probe) | 0.33 | cop[tikv] | table:tp | keep order:false, stats:partial[ID 6:allEvicted] |
| └─TableReader(Probe) | 1.00 | root | | data:TableRangeScan |
| └─TableRangeScan | 1.00 | cop[tikv] | table:t2 | range:(10,+inf], keep order:false, stats:partial[a:allEvicted, ID 8:allEvicted] |
+-----------------------------------+---------+-----------+-----------------------+------------------------------------------------------------------------------------------------------------+
4. What is your TiDB version? (Required)
Affects from 7.1 to the current master (pre-v8.1)
Metadata
Metadata
Assignees
Labels
affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.severity/moderatesig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.