github.com/whtcorpsinc/milevadb-prod@v0.0.0-20211104133533-f57f4be3b597/dbs/cmd/benchdb/explaintest/r/explain_easy_stats.result (about) 1 use test; 2 drop causet if exists t1, t2, t3; 3 create causet t1 (c1 int primary key, c2 int, c3 int, index c2 (c2)); 4 load stats 's/explain_easy_stats_t1.json'; 5 create causet t2 (c1 int unique, c2 int); 6 load stats 's/explain_easy_stats_t2.json'; 7 create causet t3 (a bigint, b bigint, c bigint, d bigint); 8 load stats 's/explain_easy_stats_t3.json'; 9 create causet index_prune(a bigint(20) NOT NULL, b bigint(20) NOT NULL, c tinyint(4) NOT NULL, primary key(a, b), index idx_b_c_a(b, c, a)); 10 load stats 's/explain_easy_stats_index_prune.json'; 11 set @@stochastik.milevadb_opt_agg_push_down = 1; 12 set @@stochastik.milevadb_opt_insubq_to_join_and_agg=1; 13 set @@stochastik.milevadb_hashagg_partial_concurrency = 1; 14 set @@stochastik.milevadb_hashagg_final_concurrency = 1; 15 explain select * from t3 where exists (select s.a from t3 s having sum(s.a) = t3.a ); 16 id estRows task access object operator info 17 HashJoin_12 1600.00 root semi join, equal:[eq(DeferredCauset#13, DeferredCauset#11)] 18 ├─StreamAgg_27(Build) 1.00 root funcs:sum(DeferredCauset#16)->DeferredCauset#11 19 │ └─TableReader_28 1.00 root data:StreamAgg_19 20 │ └─StreamAgg_19 1.00 cop[einsteindb] funcs:sum(test.t3.a)->DeferredCauset#16 21 │ └─TableFullScan_26 2000.00 cop[einsteindb] causet:s keep order:false 22 └─Projection_13(Probe) 2000.00 root test.t3.a, test.t3.b, test.t3.c, test.t3.d, cast(test.t3.a, decimal(20,0) BINARY)->DeferredCauset#13 23 └─TableReader_15 2000.00 root data:TableFullScan_14 24 └─TableFullScan_14 2000.00 cop[einsteindb] causet:t3 keep order:false 25 explain select * from t1; 26 id estRows task access object operator info 27 TableReader_5 1999.00 root data:TableFullScan_4 28 └─TableFullScan_4 1999.00 cop[einsteindb] causet:t1 keep order:false 29 explain select * from t1 order by c2; 30 id estRows task access object operator info 31 IndexLookUp_12 1999.00 root 32 ├─IndexFullScan_10(Build) 1999.00 cop[einsteindb] causet:t1, index:c2(c2) keep order:true 33 └─TableRowIDScan_11(Probe) 1999.00 cop[einsteindb] causet:t1 keep order:false 34 explain select * from t2 order by c2; 35 id estRows task access object operator info 36 Sort_4 1985.00 root test.t2.c2 37 └─TableReader_8 1985.00 root data:TableFullScan_7 38 └─TableFullScan_7 1985.00 cop[einsteindb] causet:t2 keep order:false 39 explain select * from t1 where t1.c1 > 0; 40 id estRows task access object operator info 41 TableReader_6 1999.00 root data:TableRangeScan_5 42 └─TableRangeScan_5 1999.00 cop[einsteindb] causet:t1 range:(0,+inf], keep order:false 43 explain select t1.c1, t1.c2 from t1 where t1.c2 = 1; 44 id estRows task access object operator info 45 IndexReader_6 0.00 root index:IndexRangeScan_5 46 └─IndexRangeScan_5 0.00 cop[einsteindb] causet:t1, index:c2(c2) range:[1,1], keep order:false 47 explain select * from t1 left join t2 on t1.c2 = t2.c1 where t1.c1 > 1; 48 id estRows task access object operator info 49 HashJoin_22 2481.25 root left outer join, equal:[eq(test.t1.c2, test.t2.c1)] 50 ├─TableReader_36(Build) 1985.00 root data:Selection_35 51 │ └─Selection_35 1985.00 cop[einsteindb] not(isnull(test.t2.c1)) 52 │ └─TableFullScan_34 1985.00 cop[einsteindb] causet:t2 keep order:false 53 └─TableReader_33(Probe) 1998.00 root data:TableRangeScan_32 54 └─TableRangeScan_32 1998.00 cop[einsteindb] causet:t1 range:(1,+inf], keep order:false 55 explain uFIDelate t1 set t1.c2 = 2 where t1.c1 = 1; 56 id estRows task access object operator info 57 UFIDelate_2 N/A root N/A 58 └─Point_Get_1 1.00 root causet:t1 handle:1 59 explain delete from t1 where t1.c2 = 1; 60 id estRows task access object operator info 61 Delete_4 N/A root N/A 62 └─IndexLookUp_11 0.00 root 63 ├─IndexRangeScan_9(Build) 0.00 cop[einsteindb] causet:t1, index:c2(c2) range:[1,1], keep order:false 64 └─TableRowIDScan_10(Probe) 0.00 cop[einsteindb] causet:t1 keep order:false 65 explain select count(b.c2) from t1 a, t2 b where a.c1 = b.c2 group by a.c1; 66 id estRows task access object operator info 67 Projection_11 1985.00 root cast(DeferredCauset#8, bigint(21) BINARY)->DeferredCauset#7 68 └─HashJoin_21 1985.00 root inner join, equal:[eq(test.t1.c1, test.t2.c2)] 69 ├─HashAgg_25(Build) 1985.00 root group by:test.t2.c2, funcs:count(test.t2.c2)->DeferredCauset#8, funcs:firstrow(test.t2.c2)->test.t2.c2 70 │ └─TableReader_32 1985.00 root data:Selection_31 71 │ └─Selection_31 1985.00 cop[einsteindb] not(isnull(test.t2.c2)) 72 │ └─TableFullScan_30 1985.00 cop[einsteindb] causet:b keep order:false 73 └─TableReader_34(Probe) 1999.00 root data:TableFullScan_33 74 └─TableFullScan_33 1999.00 cop[einsteindb] causet:a keep order:false 75 explain select * from t2 order by t2.c2 limit 0, 1; 76 id estRows task access object operator info 77 TopN_7 1.00 root test.t2.c2, offset:0, count:1 78 └─TableReader_15 1.00 root data:TopN_14 79 └─TopN_14 1.00 cop[einsteindb] test.t2.c2, offset:0, count:1 80 └─TableFullScan_13 1985.00 cop[einsteindb] causet:t2 keep order:false 81 explain select * from t1 where c1 > 1 and c2 = 1 and c3 < 1; 82 id estRows task access object operator info 83 IndexLookUp_11 0.00 root 84 ├─IndexRangeScan_8(Build) 0.00 cop[einsteindb] causet:t1, index:c2(c2) range:(1 1,1 +inf], keep order:false 85 └─Selection_10(Probe) 0.00 cop[einsteindb] lt(test.t1.c3, 1) 86 └─TableRowIDScan_9 0.00 cop[einsteindb] causet:t1 keep order:false 87 explain select * from t1 where c1 = 1 and c2 > 1; 88 id estRows task access object operator info 89 Selection_6 0.50 root gt(test.t1.c2, 1) 90 └─Point_Get_5 1.00 root causet:t1 handle:1 91 explain select c1 from t1 where c1 in (select c2 from t2); 92 id estRows task access object operator info 93 HashJoin_19 1985.00 root inner join, equal:[eq(test.t1.c1, test.t2.c2)] 94 ├─HashAgg_23(Build) 1985.00 root group by:test.t2.c2, funcs:firstrow(test.t2.c2)->test.t2.c2 95 │ └─TableReader_30 1985.00 root data:Selection_29 96 │ └─Selection_29 1985.00 cop[einsteindb] not(isnull(test.t2.c2)) 97 │ └─TableFullScan_28 1985.00 cop[einsteindb] causet:t2 keep order:false 98 └─TableReader_32(Probe) 1999.00 root data:TableFullScan_31 99 └─TableFullScan_31 1999.00 cop[einsteindb] causet:t1 keep order:false 100 explain select * from information_schema.columns; 101 id estRows task access object operator info 102 MemTableScan_4 10000.00 root causet:COLUMNS 103 explain select c2 = (select c2 from t2 where t1.c1 = t2.c1 order by c1 limit 1) from t1; 104 id estRows task access object operator info 105 Projection_12 1999.00 root eq(test.t1.c2, test.t2.c2)->DeferredCauset#8 106 └─Apply_14 1999.00 root CARTESIAN left outer join 107 ├─TableReader_16(Build) 1999.00 root data:TableFullScan_15 108 │ └─TableFullScan_15 1999.00 cop[einsteindb] causet:t1 keep order:false 109 └─Projection_43(Probe) 1.00 root test.t2.c1, test.t2.c2 110 └─IndexLookUp_42 1.00 root limit embedded(offset:0, count:1) 111 ├─Limit_41(Build) 1.00 cop[einsteindb] offset:0, count:1 112 │ └─IndexRangeScan_39 1.25 cop[einsteindb] causet:t2, index:c1(c1) range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true 113 └─TableRowIDScan_40(Probe) 1.00 cop[einsteindb] causet:t2 keep order:false, stats:pseudo 114 explain select * from t1 order by c1 desc limit 1; 115 id estRows task access object operator info 116 Limit_10 1.00 root offset:0, count:1 117 └─TableReader_20 1.00 root data:Limit_19 118 └─Limit_19 1.00 cop[einsteindb] offset:0, count:1 119 └─TableFullScan_18 1.00 cop[einsteindb] causet:t1 keep order:true, desc 120 set @@stochastik.milevadb_opt_insubq_to_join_and_agg=0; 121 explain select 1 in (select c2 from t2) from t1; 122 id estRows task access object operator info 123 HashJoin_7 1999.00 root CARTESIAN left outer semi join 124 ├─TableReader_14(Build) 0.00 root data:Selection_13 125 │ └─Selection_13 0.00 cop[einsteindb] eq(1, test.t2.c2) 126 │ └─TableFullScan_12 1985.00 cop[einsteindb] causet:t2 keep order:false 127 └─TableReader_9(Probe) 1999.00 root data:TableFullScan_8 128 └─TableFullScan_8 1999.00 cop[einsteindb] causet:t1 keep order:false 129 explain format="dot" select 1 in (select c2 from t2) from t1; 130 dot contents 131 132 digraph HashJoin_7 { 133 subgraph cluster7{ 134 node [style=filled, color=lightgrey] 135 color=black 136 label = "root" 137 "HashJoin_7" -> "TableReader_9" 138 "HashJoin_7" -> "TableReader_14" 139 } 140 subgraph cluster8{ 141 node [style=filled, color=lightgrey] 142 color=black 143 label = "cop" 144 "TableFullScan_8" 145 } 146 subgraph cluster13{ 147 node [style=filled, color=lightgrey] 148 color=black 149 label = "cop" 150 "Selection_13" -> "TableFullScan_12" 151 } 152 "TableReader_9" -> "TableFullScan_8" 153 "TableReader_14" -> "Selection_13" 154 } 155 156 explain select * from index_prune WHERE a = 1010010404050976781 AND b = 26467085526790 LIMIT 1; 157 id estRows task access object operator info 158 Point_Get_1 1.00 root causet:index_prune, index:PRIMARY(a, b) 159 explain select * from index_prune WHERE a = 1010010404050976781 AND b = 26467085526790 LIMIT 0; 160 id estRows task access object operator info 161 TableDual_5 0.00 root rows:0 162 explain select * from index_prune WHERE a = 1010010404050976781 AND b = 26467085526790 LIMIT 1, 1; 163 id estRows task access object operator info 164 Limit_9 1.00 root offset:1, count:1 165 └─Point_Get_11 1.00 root causet:index_prune, index:PRIMARY(a, b) 166 explain select * from index_prune WHERE a = 1010010404050976781 AND b = 26467085526790 LIMIT 1, 0; 167 id estRows task access object operator info 168 Limit_9 0.00 root offset:1, count:0 169 └─Point_Get_11 1.00 root causet:index_prune, index:PRIMARY(a, b) 170 explain select * from index_prune WHERE a = 1010010404050976781 AND b = 26467085526790 LIMIT 0, 1; 171 id estRows task access object operator info 172 Point_Get_1 1.00 root causet:index_prune, index:PRIMARY(a, b) 173 explain select * from index_prune WHERE a = 1010010404050976781 AND b = 26467085526790 ORDER BY a; 174 id estRows task access object operator info 175 Point_Get_1 1.00 root causet:index_prune, index:PRIMARY(a, b) 176 explain select * from index_prune WHERE a = 1010010404050976781 AND b = 26467085526790 GROUP BY b; 177 id estRows task access object operator info 178 Point_Get_1 1.00 root causet:index_prune, index:PRIMARY(a, b) 179 explain select * from index_prune WHERE a = 1010010404050976781 AND b = 26467085526790 GROUP BY b ORDER BY a limit 1; 180 id estRows task access object operator info 181 Point_Get_1 1.00 root causet:index_prune, index:PRIMARY(a, b) 182 drop causet if exists t1, t2, t3, index_prune; 183 set @@stochastik.milevadb_opt_insubq_to_join_and_agg=1; 184 drop causet if exists tbl; 185 create causet tbl(column1 int, column2 int, index idx(column1, column2)); 186 load stats 's/explain_easy_stats_tbl_dnf.json'; 187 explain select * from tbl where (column1=0 and column2=1) or (column1=1 and column2=3) or (column1=2 and column2=5); 188 id estRows task access object operator info 189 IndexReader_6 3.00 root index:IndexRangeScan_5 190 └─IndexRangeScan_5 3.00 cop[einsteindb] causet:tbl, index:idx(column1, column2) range:[0 1,0 1], [1 3,1 3], [2 5,2 5], keep order:false