Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
planner: generate physical plan for IndexMergePath (#11245)
- Loading branch information
Showing
11 changed files
with
385 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
drop table if exists t; | ||
create table t (a int primary key, b int, c int, d int, e int, f int); | ||
create index tb on t (b); | ||
create index tc on t (c); | ||
create index td on t (d); | ||
load stats 's/explain_indexmerge_stats_t.json'; | ||
set session tidb_enable_index_merge = on; | ||
explain select * from t where a < 50 or b < 50; | ||
id count task operator info | ||
IndexMerge_11 98.00 root | ||
├─TableScan_8 49.00 cop table:t, range:[-inf,50), keep order:false | ||
├─IndexScan_9 49.00 cop table:t, index:b, range:[-inf,50), keep order:false | ||
└─TableScan_10 98.00 cop table:t, keep order:false | ||
explain select * from t where (a < 50 or b < 50) and f > 100; | ||
id count task operator info | ||
IndexMerge_12 98.00 root | ||
├─TableScan_8 49.00 cop table:t, range:[-inf,50), keep order:false | ||
├─IndexScan_9 49.00 cop table:t, index:b, range:[-inf,50), keep order:false | ||
└─Selection_11 98.00 cop gt(test.t.f, 100) | ||
└─TableScan_10 98.00 cop table:t, keep order:false | ||
explain select * from t where a < 50 or b < 5000000; | ||
id count task operator info | ||
TableReader_7 4000000.00 root data:Selection_6 | ||
└─Selection_6 4000000.00 cop or(lt(test.t.a, 50), lt(test.t.b, 5000000)) | ||
└─TableScan_5 5000000.00 cop table:t, range:[-inf,+inf], keep order:false | ||
explain select * from t where b < 50 or c < 50; | ||
id count task operator info | ||
IndexMerge_11 98.00 root | ||
├─IndexScan_8 49.00 cop table:t, index:b, range:[-inf,50), keep order:false | ||
├─IndexScan_9 49.00 cop table:t, index:c, range:[-inf,50), keep order:false | ||
└─TableScan_10 98.00 cop table:t, keep order:false | ||
explain select * from t where b < 50 or c < 5000000; | ||
id count task operator info | ||
TableReader_7 4000000.00 root data:Selection_6 | ||
└─Selection_6 4000000.00 cop or(lt(test.t.b, 50), lt(test.t.c, 5000000)) | ||
└─TableScan_5 5000000.00 cop table:t, range:[-inf,+inf], keep order:false | ||
explain select * from t where a < 50 or b < 50 or c < 50; | ||
id count task operator info | ||
IndexMerge_12 147.00 root | ||
├─TableScan_8 49.00 cop table:t, range:[-inf,50), keep order:false | ||
├─IndexScan_9 49.00 cop table:t, index:b, range:[-inf,50), keep order:false | ||
├─IndexScan_10 49.00 cop table:t, index:c, range:[-inf,50), keep order:false | ||
└─TableScan_11 147.00 cop table:t, keep order:false | ||
explain select * from t where (b < 10000 or c < 10000) and (a < 10 or d < 10) and f < 10; | ||
id count task operator info | ||
IndexMerge_17 0.00 root | ||
├─TableScan_13 9.00 cop table:t, range:[-inf,10), keep order:false | ||
├─IndexScan_14 9.00 cop table:t, index:d, range:[-inf,10), keep order:false | ||
└─Selection_16 0.00 cop lt(test.t.f, 10), or(lt(test.t.b, 10000), lt(test.t.c, 10000)) | ||
└─TableScan_15 18.00 cop table:t, keep order:false |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
drop table if exists t; | ||
create table t (a int primary key, b int, c int, d int, e int, f int); | ||
create index tb on t (b); | ||
create index tc on t (c); | ||
create index td on t (d); | ||
load stats 's/explain_indexmerge_stats_t.json'; | ||
set session tidb_enable_index_merge = on; | ||
explain select * from t where a < 50 or b < 50; | ||
explain select * from t where (a < 50 or b < 50) and f > 100; | ||
explain select * from t where a < 50 or b < 5000000; | ||
explain select * from t where b < 50 or c < 50; | ||
explain select * from t where b < 50 or c < 5000000; | ||
explain select * from t where a < 50 or b < 50 or c < 50; | ||
explain select * from t where (b < 10000 or c < 10000) and (a < 10 or d < 10) and f < 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.