Skip to content

Commit

Permalink
util/stringutil, util/ranger, planner/core: use ; as separator in ope…
Browse files Browse the repository at this point in the history
…rationInfo of EXPLAIN

ref: pingcap#20520
  • Loading branch information
unbyte committed Mar 16, 2021
1 parent 9c48b24 commit 73cd70a
Show file tree
Hide file tree
Showing 29 changed files with 1,618 additions and 1,505 deletions.
18 changes: 9 additions & 9 deletions cmd/explaintest/r/access_path_selection.result
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,37 @@ KEY `IDX_ab` (`a`, `b`)
explain format = 'brief' select a from access_path_selection where a < 3;
id estRows task access object operator info
IndexReader 3323.33 root index:IndexRangeScan
└─IndexRangeScan 3323.33 cop[tikv] table:access_path_selection, index:IDX_a(a) range:[-inf,3), keep order:false, stats:pseudo
└─IndexRangeScan 3323.33 cop[tikv] table:access_path_selection; index:IDX_a(a) range:[-inf, 3); keep order:false; stats:pseudo
explain format = 'brief' select a, b from access_path_selection where a < 3;
id estRows task access object operator info
IndexReader 3323.33 root index:IndexRangeScan
└─IndexRangeScan 3323.33 cop[tikv] table:access_path_selection, index:IDX_ab(a, b) range:[-inf,3), keep order:false, stats:pseudo
└─IndexRangeScan 3323.33 cop[tikv] table:access_path_selection; index:IDX_ab(a, b) range:[-inf, 3); keep order:false; stats:pseudo
explain format = 'brief' select a, b from access_path_selection where b < 3;
id estRows task access object operator info
TableReader 3323.33 root data:Selection
└─Selection 3323.33 cop[tikv] lt(test.access_path_selection.b, 3)
└─TableFullScan 10000.00 cop[tikv] table:access_path_selection keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:access_path_selection keep order:false; stats:pseudo
explain format = 'brief' select a, b from access_path_selection where a < 3 and b < 3;
id estRows task access object operator info
IndexReader 1104.45 root index:Selection
└─Selection 1104.45 cop[tikv] lt(test.access_path_selection.b, 3)
└─IndexRangeScan 3323.33 cop[tikv] table:access_path_selection, index:IDX_ab(a, b) range:[-inf,3), keep order:false, stats:pseudo
└─IndexRangeScan 3323.33 cop[tikv] table:access_path_selection; index:IDX_ab(a, b) range:[-inf, 3); keep order:false; stats:pseudo
explain format = 'brief' select a, b from access_path_selection where a > 10 order by _tidb_rowid;
id estRows task access object operator info
Projection 3333.33 root test.access_path_selection.a, test.access_path_selection.b
└─TableReader 3333.33 root data:Selection
└─Selection 3333.33 cop[tikv] gt(test.access_path_selection.a, 10)
└─TableFullScan 10000.00 cop[tikv] table:access_path_selection keep order:true, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:access_path_selection keep order:true; stats:pseudo
explain format = 'brief' select max(_tidb_rowid) from access_path_selection;
id estRows task access object operator info
StreamAgg 1.00 root funcs:max(test.access_path_selection._tidb_rowid)->Column#4
└─Limit 1.00 root offset:0, count:1
└─Limit 1.00 root offset:0; count:1
└─TableReader 1.00 root data:Limit
└─Limit 1.00 cop[tikv] offset:0, count:1
└─TableFullScan 1.25 cop[tikv] table:access_path_selection keep order:true, desc, stats:pseudo
└─Limit 1.00 cop[tikv] offset:0; count:1
└─TableFullScan 1.25 cop[tikv] table:access_path_selection keep order:true; desc; stats:pseudo
explain format = 'brief' select count(1) from access_path_selection;
id estRows task access object operator info
StreamAgg 1.00 root funcs:count(Column#18)->Column#4
└─TableReader 1.00 root data:StreamAgg
└─StreamAgg 1.00 cop[tikv] funcs:count(1)->Column#18
└─TableFullScan 10000.00 cop[tikv] table:access_path_selection keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:access_path_selection keep order:false; stats:pseudo
14 changes: 7 additions & 7 deletions cmd/explaintest/r/black_list.result
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,52 @@ explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
TableReader 3323.33 root data:Selection
└─Selection 3323.33 cop[tikv] lt(test.t.a, 1)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false; stats:pseudo
insert into mysql.opt_rule_blacklist values('predicate_push_down');
admin reload opt_rule_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
Selection 8000.00 root lt(test.t.a, 1)
└─TableReader 10000.00 root data:TableFullScan
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false; stats:pseudo
delete from mysql.opt_rule_blacklist where name='predicate_push_down';
admin reload opt_rule_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
TableReader 3323.33 root data:Selection
└─Selection 3323.33 cop[tikv] lt(test.t.a, 1)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false; stats:pseudo
insert into mysql.expr_pushdown_blacklist values('<', 'tikv,tiflash,tidb', 'for test');
admin reload expr_pushdown_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
Selection 8000.00 root lt(test.t.a, 1)
└─TableReader 10000.00 root data:TableFullScan
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false; stats:pseudo
delete from mysql.expr_pushdown_blacklist where name='<' and store_type = 'tikv,tiflash,tidb' and reason = 'for test';
admin reload expr_pushdown_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
TableReader 3323.33 root data:Selection
└─Selection 3323.33 cop[tikv] lt(test.t.a, 1)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false; stats:pseudo
insert into mysql.expr_pushdown_blacklist values('lt', 'tikv,tiflash,tidb', 'for test');
admin reload expr_pushdown_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
Selection 8000.00 root lt(test.t.a, 1)
└─TableReader 10000.00 root data:TableFullScan
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false; stats:pseudo
delete from mysql.expr_pushdown_blacklist where name='lt' and store_type = 'tikv,tiflash,tidb' and reason = 'for test';
admin reload expr_pushdown_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
TableReader 3323.33 root data:Selection
└─Selection 3323.33 cop[tikv] lt(test.t.a, 1)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false; stats:pseudo
34 changes: 17 additions & 17 deletions cmd/explaintest/r/clustered_index.result
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,30 @@ id estRows task access object operator info
StreamAgg_17 1.00 root funcs:count(Column#8)->Column#6
└─IndexReader_18 1.00 root index:StreamAgg_9
└─StreamAgg_9 1.00 cop[tikv] funcs:count(1)->Column#8
└─IndexRangeScan_16 798.90 cop[tikv] table:tbl_0, index:idx_3(col_0) range:[-inf,5429), keep order:false
└─IndexRangeScan_16 798.90 cop[tikv] table:tbl_0; index:idx_3(col_0) range:[-inf, 5429); keep order:false
explain select count(*) from wout_cluster_index.tbl_0 where col_0 < 5429 ;
id estRows task access object operator info
StreamAgg_17 1.00 root funcs:count(Column#9)->Column#7
└─IndexReader_18 1.00 root index:StreamAgg_9
└─StreamAgg_9 1.00 cop[tikv] funcs:count(1)->Column#9
└─IndexRangeScan_16 798.90 cop[tikv] table:tbl_0, index:idx_3(col_0) range:[-inf,5429), keep order:false
└─IndexRangeScan_16 798.90 cop[tikv] table:tbl_0; index:idx_3(col_0) range:[-inf, 5429); keep order:false
explain select count(*) from with_cluster_index.tbl_0 where col_0 < 41 ;
id estRows task access object operator info
StreamAgg_17 1.00 root funcs:count(Column#8)->Column#6
└─IndexReader_18 1.00 root index:StreamAgg_9
└─StreamAgg_9 1.00 cop[tikv] funcs:count(1)->Column#8
└─IndexRangeScan_16 41.00 cop[tikv] table:tbl_0, index:idx_3(col_0) range:[-inf,41), keep order:false
└─IndexRangeScan_16 41.00 cop[tikv] table:tbl_0; index:idx_3(col_0) range:[-inf, 41); keep order:false
explain select count(*) from wout_cluster_index.tbl_0 where col_0 < 41 ;
id estRows task access object operator info
StreamAgg_17 1.00 root funcs:count(Column#9)->Column#7
└─IndexReader_18 1.00 root index:StreamAgg_9
└─StreamAgg_9 1.00 cop[tikv] funcs:count(1)->Column#9
└─IndexRangeScan_16 41.00 cop[tikv] table:tbl_0, index:idx_3(col_0) range:[-inf,41), keep order:false
└─IndexRangeScan_16 41.00 cop[tikv] table:tbl_0; index:idx_3(col_0) range:[-inf, 41); keep order:false
explain select col_14 from with_cluster_index.tbl_2 where col_11 <> '2013-11-01' ;
id estRows task access object operator info
Projection_4 4509.00 root with_cluster_index.tbl_2.col_14
└─IndexReader_6 4509.00 root index:IndexRangeScan_5
└─IndexRangeScan_5 4509.00 cop[tikv] table:tbl_2, index:idx_9(col_11) range:[-inf,2013-11-01 00:00:00), (2013-11-01 00:00:00,+inf], keep order:false
└─IndexRangeScan_5 4509.00 cop[tikv] table:tbl_2; index:idx_9(col_11) range:[-inf, 2013-11-01 00:00:00) | (2013-11-01 00:00:00, +inf]; keep order:false
explain select col_14 from wout_cluster_index.tbl_2 where col_11 <> '2013-11-01' ;
id estRows task access object operator info
Projection_4 4509.00 root wout_cluster_index.tbl_2.col_14
Expand All @@ -66,7 +66,7 @@ id estRows task access object operator info
StreamAgg_17 1.00 root funcs:sum(Column#8)->Column#6
└─TableReader_18 1.00 root data:StreamAgg_9
└─StreamAgg_9 1.00 cop[tikv] funcs:sum(with_cluster_index.tbl_0.col_4)->Column#8
└─TableRangeScan_16 2244.00 cop[tikv] table:tbl_0 range:[-inf,1993-12-02 00:00:00), (1993-12-02 00:00:00,+inf], keep order:false
└─TableRangeScan_16 2244.00 cop[tikv] table:tbl_0 range:[-inf, 1993-12-02 00:00:00) | (1993-12-02 00:00:00, +inf]; keep order:false
explain select sum( col_4 ) from wout_cluster_index.tbl_0 where col_3 != '1993-12-02' ;
id estRows task access object operator info
StreamAgg_37 1.00 root funcs:sum(Column#20)->Column#7
Expand All @@ -77,29 +77,29 @@ StreamAgg_37 1.00 root funcs:sum(Column#20)->Column#7
explain select col_0 from with_cluster_index.tbl_0 where col_0 <= 0 ;
id estRows task access object operator info
IndexReader_6 1.00 root index:IndexRangeScan_5
└─IndexRangeScan_5 1.00 cop[tikv] table:tbl_0, index:idx_3(col_0) range:[-inf,0], keep order:false
└─IndexRangeScan_5 1.00 cop[tikv] table:tbl_0; index:idx_3(col_0) range:[-inf, 0]; keep order:false
explain select col_0 from wout_cluster_index.tbl_0 where col_0 <= 0 ;
id estRows task access object operator info
IndexReader_6 1.00 root index:IndexRangeScan_5
└─IndexRangeScan_5 1.00 cop[tikv] table:tbl_0, index:idx_3(col_0) range:[-inf,0], keep order:false
└─IndexRangeScan_5 1.00 cop[tikv] table:tbl_0; index:idx_3(col_0) range:[-inf, 0]; keep order:false
explain select col_3 from with_cluster_index.tbl_0 where col_3 >= '1981-09-15' ;
id estRows task access object operator info
TableReader_6 1859.31 root data:TableRangeScan_5
└─TableRangeScan_5 1859.31 cop[tikv] table:tbl_0 range:[1981-09-15 00:00:00,+inf], keep order:false
└─TableRangeScan_5 1859.31 cop[tikv] table:tbl_0 range:[1981-09-15 00:00:00, +inf]; keep order:false
explain select col_3 from wout_cluster_index.tbl_0 where col_3 >= '1981-09-15' ;
id estRows task access object operator info
IndexReader_10 1859.31 root index:IndexRangeScan_9
└─IndexRangeScan_9 1859.31 cop[tikv] table:tbl_0, index:idx_2(col_3) range:[1981-09-15 00:00:00,+inf], keep order:false
└─IndexRangeScan_9 1859.31 cop[tikv] table:tbl_0; index:idx_2(col_3) range:[1981-09-15 00:00:00, +inf]; keep order:false
explain select tbl_2.col_14 , tbl_0.col_1 from with_cluster_index.tbl_2 right join with_cluster_index.tbl_0 on col_3 = col_11 ;
id estRows task access object operator info
MergeJoin_6 2533.51 root right outer join, left key:with_cluster_index.tbl_2.col_11, right key:with_cluster_index.tbl_0.col_3
MergeJoin_6 2533.51 root right outer join; left key:with_cluster_index.tbl_2.col_11; right key:with_cluster_index.tbl_0.col_3
├─IndexReader_21(Build) 4509.00 root index:IndexFullScan_20
│ └─IndexFullScan_20 4509.00 cop[tikv] table:tbl_2, index:idx_9(col_11) keep order:true
│ └─IndexFullScan_20 4509.00 cop[tikv] table:tbl_2; index:idx_9(col_11) keep order:true
└─TableReader_23(Probe) 2244.00 root data:TableFullScan_22
└─TableFullScan_22 2244.00 cop[tikv] table:tbl_0 keep order:true
explain select tbl_2.col_14 , tbl_0.col_1 from wout_cluster_index.tbl_2 right join wout_cluster_index.tbl_0 on col_3 = col_11 ;
id estRows task access object operator info
HashJoin_22 2533.51 root right outer join, equal:[eq(wout_cluster_index.tbl_2.col_11, wout_cluster_index.tbl_0.col_3)]
HashJoin_22 2533.51 root right outer join; equal:[eq(wout_cluster_index.tbl_2.col_11, wout_cluster_index.tbl_0.col_3)]
├─TableReader_40(Build) 2244.00 root data:TableFullScan_39
│ └─TableFullScan_39 2244.00 cop[tikv] table:tbl_0 keep order:false
└─TableReader_43(Probe) 4509.00 root data:Selection_42
Expand All @@ -110,22 +110,22 @@ id estRows task access object operator info
StreamAgg_16 1.00 root funcs:count(Column#8)->Column#6
└─IndexReader_17 1.00 root index:StreamAgg_9
└─StreamAgg_9 1.00 cop[tikv] funcs:count(1)->Column#8
└─IndexRangeScan_11 1.00 cop[tikv] table:tbl_0, index:idx_3(col_0) range:[-inf,0], keep order:false
└─IndexRangeScan_11 1.00 cop[tikv] table:tbl_0; index:idx_3(col_0) range:[-inf, 0]; keep order:false
explain select count(*) from wout_cluster_index.tbl_0 where col_0 <= 0 ;
id estRows task access object operator info
StreamAgg_16 1.00 root funcs:count(Column#9)->Column#7
└─IndexReader_17 1.00 root index:StreamAgg_9
└─StreamAgg_9 1.00 cop[tikv] funcs:count(1)->Column#9
└─IndexRangeScan_11 1.00 cop[tikv] table:tbl_0, index:idx_3(col_0) range:[-inf,0], keep order:false
└─IndexRangeScan_11 1.00 cop[tikv] table:tbl_0; index:idx_3(col_0) range:[-inf, 0]; keep order:false
explain select count(*) from with_cluster_index.tbl_0 where col_0 >= 803163 ;
id estRows task access object operator info
StreamAgg_17 1.00 root funcs:count(Column#8)->Column#6
└─IndexReader_18 1.00 root index:StreamAgg_9
└─StreamAgg_9 1.00 cop[tikv] funcs:count(1)->Column#8
└─IndexRangeScan_16 109.70 cop[tikv] table:tbl_0, index:idx_3(col_0) range:[803163,+inf], keep order:false
└─IndexRangeScan_16 109.70 cop[tikv] table:tbl_0; index:idx_3(col_0) range:[803163, +inf]; keep order:false
explain select count(*) from wout_cluster_index.tbl_0 where col_0 >= 803163 ;
id estRows task access object operator info
StreamAgg_17 1.00 root funcs:count(Column#9)->Column#7
└─IndexReader_18 1.00 root index:StreamAgg_9
└─StreamAgg_9 1.00 cop[tikv] funcs:count(1)->Column#9
└─IndexRangeScan_16 109.70 cop[tikv] table:tbl_0, index:idx_3(col_0) range:[803163,+inf], keep order:false
└─IndexRangeScan_16 109.70 cop[tikv] table:tbl_0; index:idx_3(col_0) range:[803163, +inf]; keep order:false
8 changes: 4 additions & 4 deletions cmd/explaintest/r/explain-non-select-stmt.result
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ explain format = 'brief' insert into t select * from t;
id estRows task access object operator info
Insert N/A root N/A
└─TableReader 10000.00 root data:TableFullScan
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false; stats:pseudo
explain format = 'brief' delete from t where a > 100;
id estRows task access object operator info
Delete N/A root N/A
└─TableReader 3333.33 root data:Selection
└─Selection 3333.33 cop[tikv] gt(test.t.a, 100)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false; stats:pseudo
explain format = 'brief' update t set b = 100 where a = 200;
id estRows task access object operator info
Update N/A root N/A
└─TableReader 10.00 root data:Selection
└─Selection 10.00 cop[tikv] eq(test.t.a, 200)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false; stats:pseudo
explain format = 'brief' replace into t select a, 100 from t;
id estRows task access object operator info
Insert N/A root N/A
└─Projection 10000.00 root test.t.a, 100->Column#6
└─TableReader 10000.00 root data:TableFullScan
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false; stats:pseudo
8 changes: 4 additions & 4 deletions cmd/explaintest/r/explain.result
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ set session tidb_hashagg_partial_concurrency = 1;
set session tidb_hashagg_final_concurrency = 1;
explain format = 'brief' select group_concat(a) from t group by id;
id estRows task access object operator info
StreamAgg 8000.00 root group by:Column#6, funcs:group_concat(Column#5 separator ",")->Column#4
StreamAgg 8000.00 root group by:Column#6; funcs:group_concat(Column#5 separator ",")->Column#4
└─Projection 10000.00 root cast(test.t.a, var_string(20))->Column#5, test.t.id
└─TableReader 10000.00 root data:TableFullScan
└─TableFullScan 10000.00 cop[tikv] table:t keep order:true, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:true; stats:pseudo
explain format = 'brief' select group_concat(a, b) from t group by id;
id estRows task access object operator info
StreamAgg 8000.00 root group by:Column#7, funcs:group_concat(Column#5, Column#6 separator ",")->Column#4
StreamAgg 8000.00 root group by:Column#7; funcs:group_concat(Column#5, Column#6 separator ",")->Column#4
└─Projection 10000.00 root cast(test.t.a, var_string(20))->Column#5, cast(test.t.b, var_string(20))->Column#6, test.t.id
└─TableReader 10000.00 root data:TableFullScan
└─TableFullScan 10000.00 cop[tikv] table:t keep order:true, stats:pseudo
└─TableFullScan 10000.00 cop[tikv] table:t keep order:true; stats:pseudo
drop table t;
drop view if exists v;
create view v as select cast(replace(substring_index(substring_index("",',',1),':',-1),'"','') as CHAR(32)) as event_id;
Expand Down
Loading

0 comments on commit 73cd70a

Please sign in to comment.