From f8e06911c4fb3bec00f4fd952efc4cd63f9bfb2e Mon Sep 17 00:00:00 2001 From: Mingcong Han Date: Mon, 9 Sep 2019 19:13:41 +0800 Subject: [PATCH 1/7] resolve conflict --- cmd/explaintest/r/explain_easy.result | 162 +-- cmd/explaintest/r/explain_easy_stats.result | 46 +- cmd/explaintest/r/partition_pruning.result | 1314 +++++++++---------- cmd/explaintest/r/select.result | 26 +- cmd/explaintest/r/subquery.result | 2 +- cmd/explaintest/r/window_function.result | 4 +- docs/design/2019-04-11-indexmerge.md | 558 ++++---- executor/admin_test.go | 4 +- planner/core/cbo_test.go | 38 +- planner/core/find_best_task.go | 11 +- planner/core/logical_plan_test.go | 16 +- planner/core/physical_plan_test.go | 28 +- session/session_test.go | 20 +- util/admin/admin.go | 2 +- util/ranger/ranger_test.go | 10 +- 15 files changed, 1123 insertions(+), 1118 deletions(-) diff --git a/cmd/explaintest/r/explain_easy.result b/cmd/explaintest/r/explain_easy.result index a5bc3fd362849..dbfed027cef57 100644 --- a/cmd/explaintest/r/explain_easy.result +++ b/cmd/explaintest/r/explain_easy.result @@ -89,12 +89,12 @@ TableReader_7 0.33 root data:Selection_6 explain select sum(t1.c1 in (select c1 from t2)) from t1; id count task operator info StreamAgg_12 1.00 root funcs:sum(col_0) -└─Projection_19 10000.00 root cast(5_aux_0) - └─HashLeftJoin_18 10000.00 root CARTESIAN left outer semi join, inner:TableReader_17, other cond:eq(test.t1.c1, test.t2.c1) - ├─TableReader_15 10000.00 root data:TableScan_14 - │ └─TableScan_14 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo - └─TableReader_17 10000.00 root data:TableScan_16 - └─TableScan_16 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo +└─Projection_23 10000.00 root cast(5_aux_0) + └─HashLeftJoin_22 10000.00 root CARTESIAN left outer semi join, inner:IndexReader_21, other cond:eq(test.t1.c1, test.t2.c1) + ├─IndexReader_17 10000.00 root index:IndexScan_16 + │ └─IndexScan_16 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexReader_21 10000.00 root index:IndexScan_20 + └─IndexScan_20 10000.00 cop table:t2, index:c1, range:[NULL,+inf], keep order:false, stats:pseudo explain select c1 from t1 where c1 in (select c2 from t2); id count task operator info Projection_9 9990.00 root test.t1.c1 @@ -122,15 +122,15 @@ MemTableScan_4 10000.00 root explain select c2 = (select c2 from t2 where t1.c1 = t2.c1 order by c1 limit 1) from t1; id count task operator info Projection_12 10000.00 root eq(test.t1.c2, test.t2.c2) -└─Apply_14 10000.00 root CARTESIAN left outer join, inner:Limit_21 - ├─TableReader_16 10000.00 root data:TableScan_15 - │ └─TableScan_15 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo - └─Limit_21 1.00 root offset:0, count:1 - └─Projection_41 1.00 root test.t2.c1, test.t2.c2 - └─IndexLookUp_40 1.00 root - ├─Limit_39 1.00 cop offset:0, count:1 - │ └─IndexScan_37 1.00 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true, stats:pseudo - └─TableScan_38 1.00 cop table:t2, keep order:false, stats:pseudo +└─Apply_14 10000.00 root CARTESIAN left outer join, inner:Limit_23 + ├─IndexReader_18 10000.00 root index:IndexScan_17 + │ └─IndexScan_17 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─Limit_23 1.00 root offset:0, count:1 + └─Projection_43 1.00 root test.t2.c1, test.t2.c2 + └─IndexLookUp_42 1.00 root + ├─Limit_41 1.00 cop offset:0, count:1 + │ └─IndexScan_39 1.00 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true, stats:pseudo + └─TableScan_40 1.00 cop table:t2, keep order:false, stats:pseudo explain select * from t1 order by c1 desc limit 1; id count task operator info Limit_10 1.00 root offset:0, count:1 @@ -155,12 +155,12 @@ Limit_8 1.00 root offset:0, count:1 └─TableScan_11 3.00 cop table:t4, range:(1,+inf], keep order:false, stats:pseudo explain select ifnull(null, t1.c1) from t1; id count task operator info -TableReader_5 10000.00 root data:TableScan_4 -└─TableScan_4 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_7 10000.00 root index:IndexScan_6 +└─IndexScan_6 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo explain select if(10, t1.c1, t1.c2) from t1; id count task operator info -TableReader_5 10000.00 root data:TableScan_4 -└─TableScan_4 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_7 10000.00 root index:IndexScan_6 +└─IndexScan_6 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo explain select c1 from t2 union select c1 from t2 union all select c1 from t2; id count task operator info Union_17 26000.00 root @@ -203,17 +203,17 @@ StreamAgg_13 1.00 root funcs:count(1) explain select 1 from (select count(c2), count(c3) from t1) k; id count task operator info Projection_5 1.00 root 1 -└─StreamAgg_17 1.00 root funcs:firstrow(col_0) - └─TableReader_18 1.00 root data:StreamAgg_9 +└─StreamAgg_21 1.00 root funcs:firstrow(col_0) + └─IndexReader_22 1.00 root index:StreamAgg_9 └─StreamAgg_9 1.00 cop funcs:firstrow(1) - └─TableScan_16 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo + └─IndexScan_20 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo explain select count(1) from (select max(c2), count(c3) as m from t1) k; id count task operator info StreamAgg_11 1.00 root funcs:count(1) -└─StreamAgg_23 1.00 root funcs:firstrow(col_0) - └─TableReader_24 1.00 root data:StreamAgg_15 +└─StreamAgg_27 1.00 root funcs:firstrow(col_0) + └─IndexReader_28 1.00 root index:StreamAgg_15 └─StreamAgg_15 1.00 cop funcs:firstrow(1) - └─TableScan_22 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo + └─IndexScan_26 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo explain select count(1) from (select count(c2) from t1 group by c3) k; id count task operator info StreamAgg_11 1.00 root funcs:count(1) @@ -225,31 +225,31 @@ set @@session.tidb_opt_insubq_to_join_and_agg=0; explain select sum(t1.c1 in (select c1 from t2)) from t1; id count task operator info StreamAgg_12 1.00 root funcs:sum(col_0) -└─Projection_19 10000.00 root cast(5_aux_0) - └─HashLeftJoin_18 10000.00 root CARTESIAN left outer semi join, inner:TableReader_17, other cond:eq(test.t1.c1, test.t2.c1) - ├─TableReader_15 10000.00 root data:TableScan_14 - │ └─TableScan_14 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo - └─TableReader_17 10000.00 root data:TableScan_16 - └─TableScan_16 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo +└─Projection_23 10000.00 root cast(5_aux_0) + └─HashLeftJoin_22 10000.00 root CARTESIAN left outer semi join, inner:IndexReader_21, other cond:eq(test.t1.c1, test.t2.c1) + ├─IndexReader_17 10000.00 root index:IndexScan_16 + │ └─IndexScan_16 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexReader_21 10000.00 root index:IndexScan_20 + └─IndexScan_20 10000.00 cop table:t2, index:c1, range:[NULL,+inf], keep order:false, stats:pseudo explain select 1 in (select c2 from t2) from t1; id count task operator info Projection_6 10000.00 root 5_aux_0 -└─HashLeftJoin_7 10000.00 root CARTESIAN left outer semi join, inner:TableReader_12 - ├─TableReader_9 10000.00 root data:TableScan_8 - │ └─TableScan_8 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo - └─TableReader_12 10.00 root data:Selection_11 - └─Selection_11 10.00 cop eq(1, test.t2.c2) - └─TableScan_10 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo +└─HashLeftJoin_7 10000.00 root CARTESIAN left outer semi join, inner:TableReader_14 + ├─IndexReader_11 10000.00 root index:IndexScan_10 + │ └─IndexScan_10 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─TableReader_14 10.00 root data:Selection_13 + └─Selection_13 10.00 cop eq(1, test.t2.c2) + └─TableScan_12 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo explain select sum(6 in (select c2 from t2)) from t1; id count task operator info StreamAgg_12 1.00 root funcs:sum(col_0) -└─Projection_20 10000.00 root cast(5_aux_0) - └─HashLeftJoin_19 10000.00 root CARTESIAN left outer semi join, inner:TableReader_18 - ├─TableReader_15 10000.00 root data:TableScan_14 - │ └─TableScan_14 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo - └─TableReader_18 10.00 root data:Selection_17 - └─Selection_17 10.00 cop eq(6, test.t2.c2) - └─TableScan_16 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo +└─Projection_22 10000.00 root cast(5_aux_0) + └─HashLeftJoin_21 10000.00 root CARTESIAN left outer semi join, inner:TableReader_20 + ├─IndexReader_17 10000.00 root index:IndexScan_16 + │ └─IndexScan_16 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─TableReader_20 10.00 root data:Selection_19 + └─Selection_19 10.00 cop eq(6, test.t2.c2) + └─TableScan_18 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo explain format="dot" select sum(t1.c1 in (select c1 from t2)) from t1; dot contents @@ -258,25 +258,25 @@ subgraph cluster12{ node [style=filled, color=lightgrey] color=black label = "root" -"StreamAgg_12" -> "Projection_19" -"Projection_19" -> "HashLeftJoin_18" -"HashLeftJoin_18" -> "TableReader_15" -"HashLeftJoin_18" -> "TableReader_17" +"StreamAgg_12" -> "Projection_23" +"Projection_23" -> "HashLeftJoin_22" +"HashLeftJoin_22" -> "IndexReader_17" +"HashLeftJoin_22" -> "IndexReader_21" } -subgraph cluster14{ +subgraph cluster16{ node [style=filled, color=lightgrey] color=black label = "cop" -"TableScan_14" +"IndexScan_16" } -subgraph cluster16{ +subgraph cluster20{ node [style=filled, color=lightgrey] color=black label = "cop" -"TableScan_16" +"IndexScan_20" } -"TableReader_15" -> "TableScan_14" -"TableReader_17" -> "TableScan_16" +"IndexReader_17" -> "IndexScan_16" +"IndexReader_21" -> "IndexScan_20" } explain format="dot" select 1 in (select c2 from t2) from t1; @@ -288,23 +288,23 @@ node [style=filled, color=lightgrey] color=black label = "root" "Projection_6" -> "HashLeftJoin_7" -"HashLeftJoin_7" -> "TableReader_9" -"HashLeftJoin_7" -> "TableReader_12" +"HashLeftJoin_7" -> "IndexReader_11" +"HashLeftJoin_7" -> "TableReader_14" } -subgraph cluster8{ +subgraph cluster10{ node [style=filled, color=lightgrey] color=black label = "cop" -"TableScan_8" +"IndexScan_10" } -subgraph cluster11{ +subgraph cluster13{ node [style=filled, color=lightgrey] color=black label = "cop" -"Selection_11" -> "TableScan_10" +"Selection_13" -> "TableScan_12" } -"TableReader_9" -> "TableScan_8" -"TableReader_12" -> "Selection_11" +"IndexReader_11" -> "IndexScan_10" +"TableReader_14" -> "Selection_13" } drop table if exists t1, t2, t3, t4; @@ -423,9 +423,9 @@ IndexReader_6 10.00 root index:IndexScan_5 └─IndexScan_5 10.00 cop table:t, index:a, b, range:[1,1], keep order:false, stats:pseudo explain select * from t where b in (1, 2) and b in (1, 3); id count task operator info -TableReader_7 10.00 root data:Selection_6 -└─Selection_6 10.00 cop in(test.t.b, 1, 2), in(test.t.b, 1, 3) - └─TableScan_5 10000.00 cop table:t, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_10 10.00 root index:Selection_9 +└─Selection_9 10.00 cop eq(test.t.b, 1) + └─IndexScan_8 10000.00 cop table:t, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo explain select * from t where a = 1 and a = 1; id count task operator info IndexReader_6 10.00 root index:IndexScan_5 @@ -439,20 +439,20 @@ TableDual_5 0.00 root rows:0 explain select * from t t1 join t t2 where t1.b = t2.b and t2.b is null; id count task operator info Projection_7 0.00 root test.t1.a, test.t1.b, test.t2.a, test.t2.b -└─HashRightJoin_9 0.00 root inner join, inner:TableReader_12, equal:[eq(test.t2.b, test.t1.b)] - ├─TableReader_12 0.00 root data:Selection_11 - │ └─Selection_11 0.00 cop isnull(test.t2.b), not(isnull(test.t2.b)) - │ └─TableScan_10 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo - └─TableReader_15 9990.00 root data:Selection_14 - └─Selection_14 9990.00 cop not(isnull(test.t1.b)) - └─TableScan_13 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo +└─HashRightJoin_9 0.00 root inner join, inner:IndexReader_15, equal:[eq(test.t2.b, test.t1.b)] + ├─IndexReader_15 0.00 root index:Selection_14 + │ └─Selection_14 0.00 cop isnull(test.t2.b), not(isnull(test.t2.b)) + │ └─IndexScan_13 10000.00 cop table:t2, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexReader_21 9990.00 root index:Selection_20 + └─Selection_20 9990.00 cop not(isnull(test.t1.b)) + └─IndexScan_19 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo explain select * from t t1 where not exists (select * from t t2 where t1.b = t2.b); id count task operator info -HashLeftJoin_9 8000.00 root anti semi join, inner:TableReader_13, equal:[eq(test.t1.b, test.t2.b)] -├─TableReader_11 10000.00 root data:TableScan_10 -│ └─TableScan_10 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_13 10000.00 root data:TableScan_12 - └─TableScan_12 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo +HashLeftJoin_9 8000.00 root anti semi join, inner:IndexReader_17, equal:[eq(test.t1.b, test.t2.b)] +├─IndexReader_13 10000.00 root index:IndexScan_12 +│ └─IndexScan_12 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_17 10000.00 root index:IndexScan_16 + └─IndexScan_16 10000.00 cop table:t2, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo drop table if exists t; create table t(a bigint primary key); explain select * from t where a = 1 and a = 2; @@ -484,12 +484,12 @@ create table t1(a int, b int, c int, primary key(a, b)); create table t2(a int, b int, c int, primary key(a)); explain select t1.a, t1.b from t1 left outer join t2 on t1.a = t2.a; id count task operator info -TableReader_7 10000.00 root data:TableScan_6 -└─TableScan_6 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_9 10000.00 root index:IndexScan_8 +└─IndexScan_8 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo explain select distinct t1.a, t1.b from t1 left outer join t2 on t1.a = t2.a; id count task operator info -TableReader_9 10000.00 root data:TableScan_8 -└─TableScan_8 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10000.00 root index:IndexScan_10 +└─IndexScan_10 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo drop table if exists t; create table t(a int, nb int not null, nc int not null); explain select ifnull(a, 0) from t; diff --git a/cmd/explaintest/r/explain_easy_stats.result b/cmd/explaintest/r/explain_easy_stats.result index 94b9b43381c29..19c9355b9f9d2 100644 --- a/cmd/explaintest/r/explain_easy_stats.result +++ b/cmd/explaintest/r/explain_easy_stats.result @@ -108,15 +108,15 @@ MemTableScan_4 10000.00 root explain select c2 = (select c2 from t2 where t1.c1 = t2.c1 order by c1 limit 1) from t1; id count task operator info Projection_12 1999.00 root eq(test.t1.c2, test.t2.c2) -└─Apply_14 1999.00 root CARTESIAN left outer join, inner:Limit_21 - ├─TableReader_16 1999.00 root data:TableScan_15 - │ └─TableScan_15 1999.00 cop table:t1, range:[-inf,+inf], keep order:false - └─Limit_21 1.00 root offset:0, count:1 - └─Projection_41 1.00 root test.t2.c1, test.t2.c2 - └─IndexLookUp_40 1.00 root - ├─Limit_39 1.00 cop offset:0, count:1 - │ └─IndexScan_37 1.25 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true - └─TableScan_38 1.00 cop table:t2, keep order:false, stats:pseudo +└─Apply_14 1999.00 root CARTESIAN left outer join, inner:Limit_23 + ├─IndexReader_18 1999.00 root index:IndexScan_17 + │ └─IndexScan_17 1999.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false + └─Limit_23 1.00 root offset:0, count:1 + └─Projection_43 1.00 root test.t2.c1, test.t2.c2 + └─IndexLookUp_42 1.00 root + ├─Limit_41 1.00 cop offset:0, count:1 + │ └─IndexScan_39 1.25 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true + └─TableScan_40 1.00 cop table:t2, keep order:false, stats:pseudo explain select * from t1 order by c1 desc limit 1; id count task operator info Limit_10 1.00 root offset:0, count:1 @@ -127,12 +127,12 @@ set @@session.tidb_opt_insubq_to_join_and_agg=0; explain select 1 in (select c2 from t2) from t1; id count task operator info Projection_6 1999.00 root 5_aux_0 -└─HashLeftJoin_7 1999.00 root CARTESIAN left outer semi join, inner:TableReader_12 - ├─TableReader_9 1999.00 root data:TableScan_8 - │ └─TableScan_8 1999.00 cop table:t1, range:[-inf,+inf], keep order:false - └─TableReader_12 0.00 root data:Selection_11 - └─Selection_11 0.00 cop eq(1, test.t2.c2) - └─TableScan_10 1985.00 cop table:t2, range:[-inf,+inf], keep order:false +└─HashLeftJoin_7 1999.00 root CARTESIAN left outer semi join, inner:TableReader_14 + ├─IndexReader_11 1999.00 root index:IndexScan_10 + │ └─IndexScan_10 1999.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false + └─TableReader_14 0.00 root data:Selection_13 + └─Selection_13 0.00 cop eq(1, test.t2.c2) + └─TableScan_12 1985.00 cop table:t2, range:[-inf,+inf], keep order:false explain format="dot" select 1 in (select c2 from t2) from t1; dot contents @@ -142,23 +142,23 @@ node [style=filled, color=lightgrey] color=black label = "root" "Projection_6" -> "HashLeftJoin_7" -"HashLeftJoin_7" -> "TableReader_9" -"HashLeftJoin_7" -> "TableReader_12" +"HashLeftJoin_7" -> "IndexReader_11" +"HashLeftJoin_7" -> "TableReader_14" } -subgraph cluster8{ +subgraph cluster10{ node [style=filled, color=lightgrey] color=black label = "cop" -"TableScan_8" +"IndexScan_10" } -subgraph cluster11{ +subgraph cluster13{ node [style=filled, color=lightgrey] color=black label = "cop" -"Selection_11" -> "TableScan_10" +"Selection_13" -> "TableScan_12" } -"TableReader_9" -> "TableScan_8" -"TableReader_12" -> "Selection_11" +"IndexReader_11" -> "IndexScan_10" +"TableReader_14" -> "Selection_13" } explain select * from index_prune WHERE a = 1010010404050976781 AND b = 26467085526790 LIMIT 1; diff --git a/cmd/explaintest/r/partition_pruning.result b/cmd/explaintest/r/partition_pruning.result index d4430618a0342..9cda74b961214 100644 --- a/cmd/explaintest/r/partition_pruning.result +++ b/cmd/explaintest/r/partition_pruning.result @@ -1040,490 +1040,490 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00) - └─TableScan_6 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-02 23:59:59) - └─TableScan_6 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03) - └─TableScan_6 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_6 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-02 23:59:59.000000) - └─TableScan_6 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; id count task operator info Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; id count task operator info Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03'; id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03'; id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03'; id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_6 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03'; id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03'; id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:01) - └─TableScan_6 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-02 23:59:58) - └─TableScan_6 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo DROP TABLE t1; # Test with DATE column NOT NULL CREATE TABLE t1 ( @@ -1543,490 +1543,490 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00) - └─TableScan_6 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info -TableReader_8 0.00 root data:Selection_7 -└─Selection_7 0.00 cop eq(test.t1.b, 2009-04-02 23:59:59) - └─TableScan_6 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 0.00 root index:Selection_10 +└─Selection_10 0.00 cop eq(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info -Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +Union_11 16666.67 root +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03) - └─TableScan_6 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_6 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; id count task operator info -TableReader_8 0.00 root data:Selection_7 -└─Selection_7 0.00 cop eq(test.t1.b, 2009-04-02 23:59:59.000000) - └─TableScan_6 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 0.00 root index:Selection_10 +└─Selection_10 0.00 cop eq(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; id count task operator info Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; id count task operator info Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03'; id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03'; id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03'; id count task operator info -TableReader_8 10.00 root data:Selection_7 -└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_6 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 10.00 root index:Selection_10 +└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03'; id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03'; id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_9 9970.00 root -├─TableReader_12 3323.33 root data:Selection_11 -│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_10 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_15 3323.33 root data:Selection_14 +├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_13 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_18 3323.33 root data:Selection_17 - └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) - └─TableScan_16 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_21 3323.33 root index:Selection_20 +│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_27 3323.33 root index:Selection_26 + └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info -TableReader_8 0.00 root data:Selection_7 -└─Selection_7 0.00 cop eq(test.t1.b, 2009-04-03 00:00:01) - └─TableScan_6 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 0.00 root index:Selection_10 +└─Selection_10 0.00 cop eq(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_10 13333.33 root -├─TableReader_13 3333.33 root data:Selection_12 -│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_11 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_16 3333.33 root data:Selection_15 +├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_14 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_19 3333.33 root data:Selection_18 -│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─TableScan_17 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_22 3333.33 root data:Selection_21 - └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) - └─TableScan_20 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_22 3333.33 root index:Selection_21 +│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_28 3333.33 root index:Selection_27 +│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_34 3333.33 root index:Selection_33 + └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_8 6646.67 root -├─TableReader_11 3323.33 root data:Selection_10 -│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_9 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_14 3323.33 root data:Selection_13 - └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) - └─TableScan_12 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +├─IndexReader_14 3323.33 root index:Selection_13 +│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_20 3323.33 root index:Selection_19 + └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info -TableReader_8 0.00 root data:Selection_7 -└─Selection_7 0.00 cop eq(test.t1.b, 2009-04-02 23:59:58) - └─TableScan_6 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo +IndexReader_11 0.00 root index:Selection_10 +└─Selection_10 0.00 cop eq(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_11 16666.67 root -├─TableReader_14 3333.33 root data:Selection_13 -│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_12 10000.00 cop table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_17 3333.33 root data:Selection_16 +├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_15 10000.00 cop table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_20 3333.33 root data:Selection_19 -│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_18 10000.00 cop table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo -├─TableReader_23 3333.33 root data:Selection_22 +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─TableScan_21 10000.00 cop table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo -└─TableReader_26 3333.33 root data:Selection_25 - └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) - └─TableScan_24 10000.00 cop table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_29 3333.33 root index:Selection_28 +│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_35 3333.33 root index:Selection_34 +│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_41 3333.33 root index:Selection_40 + └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo DROP TABLE t1; # Test with DATETIME column NULL CREATE TABLE t1 ( diff --git a/cmd/explaintest/r/select.result b/cmd/explaintest/r/select.result index 143cf7cc28a9f..17d660065978d 100644 --- a/cmd/explaintest/r/select.result +++ b/cmd/explaintest/r/select.result @@ -254,10 +254,10 @@ drop table if exists t; create table t (a int, b int, c int, key idx(a, b, c)); explain select count(a) from t; id count task operator info -StreamAgg_16 1.00 root funcs:count(col_0) -└─TableReader_17 1.00 root data:StreamAgg_8 +StreamAgg_20 1.00 root funcs:count(col_0) +└─IndexReader_21 1.00 root index:StreamAgg_8 └─StreamAgg_8 1.00 cop funcs:count(test.t.a) - └─TableScan_15 10000.00 cop table:t, range:[-inf,+inf], keep order:false, stats:pseudo + └─IndexScan_19 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:false, stats:pseudo select count(a) from t; count(a) 0 @@ -265,30 +265,30 @@ insert t values(0,0,0); explain select distinct b from t group by a; id count task operator info HashAgg_7 8000.00 root group by:test.t.b, funcs:firstrow(test.t.b) -└─StreamAgg_19 8000.00 root group by:col_1, funcs:firstrow(col_0) - └─IndexReader_20 8000.00 root index:StreamAgg_11 +└─StreamAgg_22 8000.00 root group by:col_1, funcs:firstrow(col_0) + └─IndexReader_23 8000.00 root index:StreamAgg_11 └─StreamAgg_11 8000.00 cop group by:test.t.a, funcs:firstrow(test.t.b) - └─IndexScan_18 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo + └─IndexScan_21 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo select distinct b from t group by a; b 0 explain select count(b) from t group by a; id count task operator info -StreamAgg_16 8000.00 root group by:col_1, funcs:count(col_0) -└─IndexReader_17 8000.00 root index:StreamAgg_8 +StreamAgg_19 8000.00 root group by:col_1, funcs:count(col_0) +└─IndexReader_20 8000.00 root index:StreamAgg_8 └─StreamAgg_8 8000.00 cop group by:test.t.a, funcs:count(test.t.b) - └─IndexScan_15 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo + └─IndexScan_18 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo select count(b) from t group by a; count(b) 1 insert t values(1,1,1),(3,3,6),(3,2,5),(2,1,4),(1,1,3),(1,1,2); explain select count(a) from t where b>0 group by a, b; id count task operator info -StreamAgg_20 2666.67 root group by:col_1, col_2, funcs:count(col_0) -└─IndexReader_21 2666.67 root index:StreamAgg_9 +StreamAgg_25 2666.67 root group by:col_1, col_2, funcs:count(col_0) +└─IndexReader_26 2666.67 root index:StreamAgg_9 └─StreamAgg_9 2666.67 cop group by:test.t.a, test.t.b, funcs:count(test.t.a) - └─Selection_19 3333.33 cop gt(test.t.b, 0) - └─IndexScan_18 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo + └─Selection_24 3333.33 cop gt(test.t.b, 0) + └─IndexScan_23 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo select count(a) from t where b>0 group by a, b; count(a) 3 diff --git a/cmd/explaintest/r/subquery.result b/cmd/explaintest/r/subquery.result index 3d367f8bbeb07..6bc53a96a6f23 100644 --- a/cmd/explaintest/r/subquery.result +++ b/cmd/explaintest/r/subquery.result @@ -16,7 +16,7 @@ analyze table t; explain select t.c in (select count(*) from t s use index(idx), t t1 where s.b = 1 and s.c = 1 and s.d = t.a and s.a = t1.a) from t; id count task operator info Projection_11 5.00 root 9_aux_0 -└─Apply_13 5.00 root CARTESIAN left outer semi join, inner:StreamAgg_20, other cond:eq(test.t.c, 7_col_0) +└─Apply_13 5.00 root CARTESIAN left outer semi join, inner:StreamAgg_22, other cond:eq(test.t.c, 7_col_0) ├─TableReader_15 5.00 root data:TableScan_14 │ └─TableScan_14 5.00 cop table:t, range:[-inf,+inf], keep order:false └─StreamAgg_20 1.00 root funcs:count(1) diff --git a/cmd/explaintest/r/window_function.result b/cmd/explaintest/r/window_function.result index 3f4e6132897fe..a42e173de48ba 100644 --- a/cmd/explaintest/r/window_function.result +++ b/cmd/explaintest/r/window_function.result @@ -6,8 +6,8 @@ explain select sum(a) over() from t; id count task operator info Projection_7 10000.00 root sum(a) over() └─Window_8 10000.00 root sum(cast(test.t.a)) over() - └─TableReader_10 10000.00 root data:TableScan_9 - └─TableScan_9 10000.00 cop table:t, range:[-inf,+inf], keep order:false, stats:pseudo + └─IndexReader_12 10000.00 root index:IndexScan_11 + └─IndexScan_11 10000.00 cop table:t, index:a, range:[NULL,+inf], keep order:false, stats:pseudo explain select sum(a) over(partition by a) from t; id count task operator info Projection_7 10000.00 root sum(a) over(partition by a) diff --git a/docs/design/2019-04-11-indexmerge.md b/docs/design/2019-04-11-indexmerge.md index aa0108d62487a..14a0e7eb5e96a 100644 --- a/docs/design/2019-04-11-indexmerge.md +++ b/docs/design/2019-04-11-indexmerge.md @@ -1,48 +1,48 @@ -# Proposal: scan a table using IndexMerge -- Author(s) : WHU -- Last updated : May 10 -- Discussion at : - - -## Abstract - -The proposal proposes to use multiple indexes to scan a table if possible. In some cases, using multiple indexes will improve performance. - -## Background - -In present TiDB, a SQL statement with conditions involving multiple indexed attributes only uses one of the conditions as the index filter to build access condition, while others are regarded as table filters. Firstly, use index scan (at most one index) to get handles (rowid in TiDB). Then use the handles to get rows and check whether the rows satisfy the conditions of table filters. Some relational databases implement a table access path using multiple indexes. In some cases, this way will improve performance. - -We take an example to explain it. We define the table schema as : - -``` -CREATE TABLE t1 (a int, b int, c int); -CREATE INDEX t1a on t1(a); -CREATE INDEX t1b on t1(b); -CREATE INDEX t1c on t1(c); -``` -And use a test SQL statement `SELECT * FROM t1 where a < 2 or b > 50`. Currently, TiDB does a table scan and puts `a < 2 or b > 50` as a Selection on top of it. If the selectivity of `a < 2 ` and `b > 50` is low, a better approach would be using indexes on columns `a` and `b` to retrieve rows respectively, and applying a union operation on the result sets. - - -## Proposal -In short, we need to consider access paths using multiple indexes. - -### Planner -We propose to add new `IndexMergeReader / PhysicalIndexMergeReader` and `IndexMergeLookUpReader / PhysicalIndexMergeLookUpReader` operators. - -Now we just consider the following two kinds of queries: - -(1)Conditions in CNF, e.g, `select * from t1 where c1 and c2 and c3 and …` - +# Proposal: scan a table using IndexMerge +- Author(s) : WHU +- Last updated : May 10 +- Discussion at : + + +## Abstract + +The proposal proposes to use multiple indexes to scan a table if possible. In some cases, using multiple indexes will improve performance. + +## Background + +In present TiDB, a SQL statement with conditions involving multiple indexed attributes only uses one of the conditions as the index filter to build access condition, while others are regarded as table filters. Firstly, use index scan (at most one index) to get handles (rowid in TiDB). Then use the handles to get rows and check whether the rows satisfy the conditions of table filters. Some relational databases implement a table access path using multiple indexes. In some cases, this way will improve performance. + +We take an example to explain it. We define the table schema as : + +``` +CREATE TABLE t1 (a int, b int, c int); +CREATE INDEX t1a on t1(a); +CREATE INDEX t1b on t1(b); +CREATE INDEX t1c on t1(c); +``` +And use a test SQL statement `SELECT * FROM t1 where a < 2 or b > 50`. Currently, TiDB does a table scan and puts `a < 2 or b > 50` as a Selection on top of it. If the selectivity of `a < 2 ` and `b > 50` is low, a better approach would be using indexes on columns `a` and `b` to retrieve rows respectively, and applying a union operation on the result sets. + + +## Proposal +In short, we need to consider access paths using multiple indexes. + +### Planner +We propose to add new `IndexMergeReader / PhysicalIndexMergeReader` and `IndexMergeLookUpReader / PhysicalIndexMergeLookUpReader` operators. + +Now we just consider the following two kinds of queries: + +(1)Conditions in CNF, e.g, `select * from t1 where c1 and c2 and c3 and …` + In this form, each CNF item can be covered by a single index respectively. For example, if we have single column indexes for `t1.a`, `ta.b` and `t1.c` respectively, for SQL `select * from t1 where (a < 10 or a > 100) and b < 10 and c > 1000`, we can use all the three indexes to read the table handles. The result plan for it is like: - -``` -PhysicalIndexMergeLookUpReader(IndexMergeIntersect) - IndexScan(t1a) - IndexScan(t1b) - IndexScan(t1c) + +``` +PhysicalIndexMergeLookUpReader(IndexMergeIntersect) + IndexScan(t1a) + IndexScan(t1b) + IndexScan(t1c) TableScan ``` - + For the CNF items not covered by any index, we take them as table filters and convert them to selection on top of the scan node. For SQL `select * from t1 where (a < 10 or c >100) and b < 10`, only item `b < 10` can be used as index access condition, so we can only consider single index lookup reader. We set up a experiment for the CNF form to compare our demo implement with the master branch. The schema and test sql form we define are following: @@ -64,17 +64,17 @@ We load two million rows into `T200M` with one to two million sequence for all c CNF 200 -**Note:** `SELECTIVITY`is for the single column. - -(2) Conditions in DNF, e.g, `select * from t1 where c1 or c2 or c3 or …` - -In this form, every DNF item must be covered by a single index. If any DNF item cannot be covered by a single index, we cannot choose IndexMerge scan. For example, SQL `select * from t1 where a > 1 or ( b >1 and b <10)` will generate a possible plan like: - -``` -PhysicalIndexMergeLookUpReader(IndexMergeUnion) - IndexScan(t1a) - IndexScan(t1b) - TableScan +**Note:** `SELECTIVITY`is for the single column. + +(2) Conditions in DNF, e.g, `select * from t1 where c1 or c2 or c3 or …` + +In this form, every DNF item must be covered by a single index. If any DNF item cannot be covered by a single index, we cannot choose IndexMerge scan. For example, SQL `select * from t1 where a > 1 or ( b >1 and b <10)` will generate a possible plan like: + +``` +PhysicalIndexMergeLookUpReader(IndexMergeUnion) + IndexScan(t1a) + IndexScan(t1b) + TableScan ``` We set up a experiment for the DNF form to compare our demo implement with the master branch. The schema and test sql form we define are following: @@ -87,235 +87,235 @@ Table Schema: Test SQL Form: SELECT * FROM T200 WHERE a < $1 OR b > $2; -``` +``` We load two million rows into `T200` with one to two million sequence for all columns. We alter the value of `$1` and `$2` in test sql form to obtain the accurate selectivities. The result can be seen in the following graph: DNF 200 - - -We design PhysicalIndexMergeLookUpReader structure as: - -``` -// PhysicalIndexMergeLookUpReader -type PhysicalIndexMergeLookUpReader struct { - physicalSchemaProducer - - //Follow two plans flat to construct executor pb. - IndexPlans []PhysicalPlan - TablePlans []PhysicalPlan - - indexPlans []PhysicalPlan - tablePlan PhysicalPlan - - IndexMergeType int -} -``` - - -- The field `IndexMergeType` indicates the operations on results of multiple index scans, and has the following possible values: - - 0: not an IndexMerge scan; - - 1: intersection operation on result sets, and with a table scan; - - 2: intersection operation on result sets, without the table scan; - - 3: union operation on result sets, must have a table scan; - + + +We design PhysicalIndexMergeLookUpReader structure as: + +``` +// PhysicalIndexMergeLookUpReader +type PhysicalIndexMergeLookUpReader struct { + physicalSchemaProducer + + //Follow two plans flat to construct executor pb. + IndexPlans []PhysicalPlan + TablePlans []PhysicalPlan + + indexPlans []PhysicalPlan + tablePlan PhysicalPlan + + IndexMergeType int +} +``` + + +- The field `IndexMergeType` indicates the operations on results of multiple index scans, and has the following possible values: + - 0: not an IndexMerge scan; + - 1: intersection operation on result sets, and with a table scan; + - 2: intersection operation on result sets, without the table scan; + - 3: union operation on result sets, must have a table scan; + In first version, we just take `PhysicalIndexMergeLookUpReader` and `PhysicalIndexMergeReader` together. - -### IndexMergePath Generate -Now, we first generate all possible IndexMergeOr paths, then generate possible IndexMergeIntersection path. - -``` -type IndexMergePath struct { - IndexPath[] - tableFilters - IndexMergeType -} -``` - - -``` -GetIndexMergeUnionPaths(IndexInfos, PushdownConditions){ - var results = nil - foreach cond in PushdownConditions { - if !isOrCondition(cond) { - continue - } - args = flatten(cond,'or') - foreach arg in args { - var indexAccessPaths, imPaths - // Common index paths would be merged later in `CreateIndexMergeUnionPath` - if isAndCondition(arg) { - andArgs = flatten(arg,'and') - indexAccessPaths = buildAccessPath(andArgs, IndexInfos) - } else { - tempArgs = []{arg} - indexAccessPaths = buildAccessPath(tempArgs, IndexInfos) - } - if indexAccessPaths == nil { - imPaths = nil - break - } - imPartialPath = GetIndexMergePartialPath(IndexInfos, indexAccessPaths) - imPaths = append(imPaths, imPartialPath) - } - if imPaths != nil { - possiblePath = CreateIndexMergeUnionPath(imPaths,PushdownConditions,con,IndexInfos) - results = append(results, possiblePath) - } - } - return results -} - - -buildAccessPath(Conditions, IndexInfos){ - var results - for index in IndexInfos { - res = detachCNFCondAndBuildRangeForIndex(Conditions, index, considerDNF = true) - if res.accessCondition = nil { - continue - } - indexPath = CreateIndexAccessPath(index, res) - results = append(results, indexPath) - } - return results -} - -// This function will get a best indexPath for a con from some alternative paths. -// now we just take the index which has more columns. -// for exmple: -// (1) -// index1(a,b,c) index2(a,b) index3(a) -// condition: a = 1 will choose index1; a = 1 and b = 2 will also choose index1 -// (2) -// index1(a) index2(b) -// condition: a = 1 and b = 1 -// random choose??? -GetIndexMergePartialPath(IndexInfos, indexAccessPaths) { -} - -// (1)maybe we will merge some indexPaths -// for example: index1(a) index2(b) -// condition : a < 1 or a > 2 or b < 1 or b > 10 -// imPaths will be [a<1,a>2,b<1,b>10] and we can merge it and get [a<1 or a >2 , b < 1 or b > 10] -// (2)IndexMergePath.tableFilters: -// <1> remove cond from PushdownConditions and the remain will be added to tableFitler. -// <2> after merge operation, if any indexPath's tableFilter is not nil, we should add it into tableFilters - -CreateIndexMergeUnionPath(imPaths,PushdownConditions,cond,IndexInfos) { -} - -``` - - -``` -GetIndexMergeIntersectionPaths(pushDownConditions, usedConditionsInOr, indexInfos) { - var partialPaths - - if len(pushDownConditions) - len(usedConditionsInOr) < 2 { - return nil - } - tableFilters := append(tableFilters, usedConditionsInOr...) - newConsiderConditions := remove(pushDownConditions, usedConditionsInOr) - for cond in newConsiderConditions { - indexPaths = buildAccessPath([]{cond}, indexInfos) - if indexPaths == nil { - tableFiltes = append(tableFilters,cond) - continue - } - indexPath := GetIndexMergePartialPath(indexPaths,indexInfos) - partialPaths = append(partialPaths, indexPath) - } - if len(partialPaths) < 2 { - return nil - } - return CreateIndexMergeIntersectionPath(partialPaths, tableFilters) -} - -// Now, we just use all path in partialPaths to generate a IndexMergeIntersection. -// We also need to merge possible paths. -// For example: -// index: ix1(a) -// condition: a > 1 and a < 10 -// we will get two partial paths and they all use index ix1. -// IndexMergePath.tableFilters: -// <1> tableFilters -// <2> after merge operation, if any indexPath's tableFilter is not nil, we -// should add indexPath’s tableFilter into IndexMergePath.tableFilters -CreateIndexMergeIntersectionPath(partialPaths, tableFilters) { -} - -``` - -### Executor -Graph bellow illustrates execution of IndexMerge scan. -Execution Model - -Every index plan in `PhysicalIndexMergeLookUpReader` will start an `IndexWorker` to execute the IndexScan plan and send handles to AndOrWorker. AndOrWorker is responsible for doing set operations (and, or) to get final handles. Then `AndOrWoker` sends final handles to `TableWokers` to get rows from TiKV. - -We can take some tricks to make execution at pipeline mode without considering the order. - - -(1) IndexMergeIntersection + +### IndexMergePath Generate +Now, we first generate all possible IndexMergeOr paths, then generate possible IndexMergeIntersection path. + +``` +type IndexMergePath struct { + IndexPath[] + tableFilters + IndexMergeType +} +``` + + +``` +GetIndexMergeUnionPaths(IndexInfos, PushdownConditions){ + var results = nil + foreach cond in PushdownConditions { + if !isOrCondition(cond) { + continue + } + args = flatten(cond,'or') + foreach arg in args { + var indexAccessPaths, imPaths + // Common index paths would be merged later in `CreateIndexMergeUnionPath` + if isAndCondition(arg) { + andArgs = flatten(arg,'and') + indexAccessPaths = buildAccessPath(andArgs, IndexInfos) + } else { + tempArgs = []{arg} + indexAccessPaths = buildAccessPath(tempArgs, IndexInfos) + } + if indexAccessPaths == nil { + imPaths = nil + break + } + imPartialPath = GetIndexMergePartialPath(IndexInfos, indexAccessPaths) + imPaths = append(imPaths, imPartialPath) + } + if imPaths != nil { + possiblePath = CreateIndexMergeUnionPath(imPaths,PushdownConditions,con,IndexInfos) + results = append(results, possiblePath) + } + } + return results +} + + +buildAccessPath(Conditions, IndexInfos){ + var results + for index in IndexInfos { + res = detachCNFCondAndBuildRangeForIndex(Conditions, index, considerDNF = true) + if res.accessCondition = nil { + continue + } + indexPath = CreateIndexAccessPath(index, res) + results = append(results, indexPath) + } + return results +} + +// This function will get a best indexPath for a con from some alternative paths. +// now we just take the index which has more columns. +// for exmple: +// (1) +// index1(a,b,c) index2(a,b) index3(a) +// condition: a = 1 will choose index1; a = 1 and b = 2 will also choose index1 +// (2) +// index1(a) index2(b) +// condition: a = 1 and b = 1 +// random choose??? +GetIndexMergePartialPath(IndexInfos, indexAccessPaths) { +} + +// (1)maybe we will merge some indexPaths +// for example: index1(a) index2(b) +// condition : a < 1 or a > 2 or b < 1 or b > 10 +// imPaths will be [a<1,a>2,b<1,b>10] and we can merge it and get [a<1 or a >2 , b < 1 or b > 10] +// (2)IndexMergePath.tableFilters: +// <1> remove cond from PushdownConditions and the remain will be added to tableFitler. +// <2> after merge operation, if any indexPath's tableFilter is not nil, we should add it into tableFilters + +CreateIndexMergeUnionPath(imPaths,PushdownConditions,cond,IndexInfos) { +} + +``` + + +``` +GetIndexMergeIntersectionPaths(pushDownConditions, usedConditionsInOr, indexInfos) { + var partialPaths + + if len(pushDownConditions) - len(usedConditionsInOr) < 2 { + return nil + } + tableFilters := append(tableFilters, usedConditionsInOr...) + newConsiderConditions := remove(pushDownConditions, usedConditionsInOr) + for cond in newConsiderConditions { + indexPaths = buildAccessPath([]{cond}, indexInfos) + if indexPaths == nil { + tableFiltes = append(tableFilters,cond) + continue + } + indexPath := GetIndexMergePartialPath(indexPaths,indexInfos) + partialPaths = append(partialPaths, indexPath) + } + if len(partialPaths) < 2 { + return nil + } + return CreateIndexMergeIntersectionPath(partialPaths, tableFilters) +} + +// Now, we just use all path in partialPaths to generate a IndexMergeIntersection. +// We also need to merge possible paths. +// For example: +// index: ix1(a) +// condition: a > 1 and a < 10 +// we will get two partial paths and they all use index ix1. +// IndexMergePath.tableFilters: +// <1> tableFilters +// <2> after merge operation, if any indexPath's tableFilter is not nil, we +// should add indexPath’s tableFilter into IndexMergePath.tableFilters +CreateIndexMergeIntersectionPath(partialPaths, tableFilters) { +} + +``` + +### Executor +Graph bellow illustrates execution of IndexMerge scan. +Execution Model + +Every index plan in `PhysicalIndexMergeLookUpReader` will start an `IndexWorker` to execute the IndexScan plan and send handles to AndOrWorker. AndOrWorker is responsible for doing set operations (and, or) to get final handles. Then `AndOrWoker` sends final handles to `TableWokers` to get rows from TiKV. + +We can take some tricks to make execution at pipeline mode without considering the order. + + +(1) IndexMergeIntersection - IndexMergeIntersection - We take an example to explain it. Use set1 to record rowids which are returned by ix1 but not sent to tableWorker. Use set2 to record the same thing for ix2. -If new rowid comes from ix1, first we check if it is in set2. If so, we delete it from set2 and send it to tableWorker. Otherwise, we add it into set1. For the above figure, we use the following table to show the processing. - -| new rowid | set1 | set2 | sent to TableWorker | -| :------:| :------: | :------: | :------: | -| 2(ix1) | [2] | [ ] | [ ] | -| 1(ix2) | [2] | [1] | [ ] | -| 5(ix1) | [2,5] |[1] | [ ] | -| 5(ix2) | [2] | [1] | [5] | -| 7(ix1) | [2,7] |[1] | [ ] | -| 2(ix2) | [7] | [1] | [2] | - - - -(2) IndexMergeUnion - - - We take a structure(we call it set) to record which rowids are accessed. If a new rowid returned by IndexScan, check if it is in set. If in it, we just skip it. Otherwise, we add it into set and send it to tableWorker. - -### Cost Model -Cost model will consider three factors: IO, CPU, and Network. - -- `IndexMergeType` = 1 - - IO Cost = (totalRowCount + mergedRowCount) * scanFactor - - Network Cost = (totalRowCount + mergedRowCount) * networkFactor - - Cpu Memory Cost = totalRowCount * cpuFactor + totalRowCount * memoryFactor - -- `IndexMergeType` = 2 - - IO Cost = (totalRowCount) * scanFactor - - Network Cost = totalRowCount * networkFactor - - Cpu Memory Cost = totalRowCount * cpuFactor + totalRowCount * memoryFactor - -- `IndexMergeType` = 3 - - IO Cost = (totalRowCount + mergedRowCount) * scanFactor - - Network Cost = (totalRowCount + mergedRowCount) * networkFactor - - Cpu Memory Cost = totalRowCount * cpuFactor + mergedRowCount * memoryFactor - - -**Note**: - -- totalRowCount: sum of handles collected from every index scan. - -- mergedRowCount: number of handles after set operating. - -## Compatibility -This proposal has no effect on the compatibility. - -## Implementation -1. Implement planner operators -1. Enhance `explain` to display the plan -3. Implement executor operators -4. Testing + IndexMergeIntersection + We take an example to explain it. Use set1 to record rowids which are returned by ix1 but not sent to tableWorker. Use set2 to record the same thing for ix2. +If new rowid comes from ix1, first we check if it is in set2. If so, we delete it from set2 and send it to tableWorker. Otherwise, we add it into set1. For the above figure, we use the following table to show the processing. + +| new rowid | set1 | set2 | sent to TableWorker | +| :------:| :------: | :------: | :------: | +| 2(ix1) | [2] | [ ] | [ ] | +| 1(ix2) | [2] | [1] | [ ] | +| 5(ix1) | [2,5] |[1] | [ ] | +| 5(ix2) | [2] | [1] | [5] | +| 7(ix1) | [2,7] |[1] | [ ] | +| 2(ix2) | [7] | [1] | [2] | + + + +(2) IndexMergeUnion + + + We take a structure(we call it set) to record which rowids are accessed. If a new rowid returned by IndexScan, check if it is in set. If in it, we just skip it. Otherwise, we add it into set and send it to tableWorker. + +### Cost Model +Cost model will consider three factors: IO, CPU, and Network. + +- `IndexMergeType` = 1 + + IO Cost = (totalRowCount + mergedRowCount) * scanFactor + + Network Cost = (totalRowCount + mergedRowCount) * networkFactor + + Cpu Memory Cost = totalRowCount * cpuFactor + totalRowCount * memoryFactor + +- `IndexMergeType` = 2 + + IO Cost = (totalRowCount) * scanFactor + + Network Cost = totalRowCount * networkFactor + + Cpu Memory Cost = totalRowCount * cpuFactor + totalRowCount * memoryFactor + +- `IndexMergeType` = 3 + + IO Cost = (totalRowCount + mergedRowCount) * scanFactor + + Network Cost = (totalRowCount + mergedRowCount) * networkFactor + + Cpu Memory Cost = totalRowCount * cpuFactor + mergedRowCount * memoryFactor + + +**Note**: + +- totalRowCount: sum of handles collected from every index scan. + +- mergedRowCount: number of handles after set operating. + +## Compatibility +This proposal has no effect on the compatibility. + +## Implementation +1. Implement planner operators +1. Enhance `explain` to display the plan +3. Implement executor operators +4. Testing diff --git a/executor/admin_test.go b/executor/admin_test.go index 843d39a67c239..4d59ebb926b81 100644 --- a/executor/admin_test.go +++ b/executor/admin_test.go @@ -145,7 +145,7 @@ func (s *testSuite2) TestAdminRecoverIndex(c *C) { r = tk.MustQuery("SELECT COUNT(*) FROM admin_test USE INDEX(c2)") r.Check(testkit.Rows("0")) - r = tk.MustQuery("SELECT COUNT(*) FROM admin_test") + r = tk.MustQuery("SELECT COUNT(*) FROM admin_test USE INDEX()") r.Check(testkit.Rows("5")) r = tk.MustQuery("admin recover index admin_test c2") @@ -380,7 +380,7 @@ func (s *testSuite2) TestAdminCleanupIndexMore(c *C) { c.Assert(err, NotNil) err = tk.ExecToErr("admin check index admin_test c2") c.Assert(err, NotNil) - r := tk.MustQuery("SELECT COUNT(*) FROM admin_test") + r := tk.MustQuery("SELECT COUNT(*) FROM admin_test USE INDEX()") r.Check(testkit.Rows("3")) r = tk.MustQuery("SELECT COUNT(*) FROM admin_test USE INDEX(c1)") r.Check(testkit.Rows("2003")) diff --git a/planner/core/cbo_test.go b/planner/core/cbo_test.go index 32a7357c70957..1ece0c570cf4d 100644 --- a/planner/core/cbo_test.go +++ b/planner/core/cbo_test.go @@ -286,7 +286,7 @@ func (s *testAnalyzeSuite) TestIndexRead(c *C) { }{ { sql: "select count(*) from t group by e", - best: "IndexReader(Index(t.e)[[NULL,+inf]]->StreamAgg)->StreamAgg", + best: "IndexReader(Index(t.e)[[NULL,+inf]])->HashAgg", }, { sql: "select count(*) from t where e <= 10 group by e", @@ -298,7 +298,7 @@ func (s *testAnalyzeSuite) TestIndexRead(c *C) { }, { sql: "select count(*) from t where c > '1' group by b", - best: "IndexReader(Index(t.b_c)[[NULL,+inf]]->Sel([gt(test.t.c, 1)])->StreamAgg)->StreamAgg", + best: "IndexReader(Index(t.b_c)[[NULL,+inf]]->Sel([gt(test.t.c, 1)]))->HashAgg", }, { sql: "select count(*) from t where e = 1 group by b", @@ -689,22 +689,22 @@ func (s *testAnalyzeSuite) TestCorrelatedEstimation(c *C) { tk.MustQuery("explain select t.c in (select count(*) from t s , t t1 where s.a = t.a and s.a = t1.a) from t;"). Check(testkit.Rows( "Projection_11 10.00 root 9_aux_0", - "└─Apply_13 10.00 root CARTESIAN left outer semi join, inner:StreamAgg_20, other cond:eq(test.t.c, 7_col_0)", + "└─Apply_13 10.00 root CARTESIAN left outer semi join, inner:StreamAgg_22, other cond:eq(test.t.c, 7_col_0)", " ├─TableReader_15 10.00 root data:TableScan_14", " │ └─TableScan_14 10.00 cop table:t, range:[-inf,+inf], keep order:false", - " └─StreamAgg_20 1.00 root funcs:count(1)", - " └─HashLeftJoin_21 1.00 root inner join, inner:TableReader_28, equal:[eq(test.s.a, test.t1.a)]", - " ├─TableReader_25 1.00 root data:Selection_24", - " │ └─Selection_24 1.00 cop eq(test.s.a, test.t.a), not(isnull(test.s.a))", - " │ └─TableScan_23 10.00 cop table:s, range:[-inf,+inf], keep order:false", - " └─TableReader_28 1.00 root data:Selection_27", - " └─Selection_27 1.00 cop eq(test.t1.a, test.t.a), not(isnull(test.t1.a))", - " └─TableScan_26 10.00 cop table:t1, range:[-inf,+inf], keep order:false", + " └─StreamAgg_22 1.00 root funcs:count(1)", + " └─HashLeftJoin_23 1.00 root inner join, inner:TableReader_33, equal:[eq(test.s.a, test.t1.a)]", + " ├─TableReader_27 1.00 root data:Selection_26", + " │ └─Selection_26 1.00 cop eq(test.s.a, test.t.a), not(isnull(test.s.a))", + " │ └─TableScan_25 10.00 cop table:s, range:[-inf,+inf], keep order:false", + " └─TableReader_33 1.00 root data:Selection_32", + " └─Selection_32 1.00 cop eq(test.t1.a, test.t.a), not(isnull(test.t1.a))", + " └─TableScan_31 10.00 cop table:t1, range:[-inf,+inf], keep order:false", )) tk.MustQuery("explain select (select concat(t1.a, \",\", t1.b) from t t1 where t1.a=t.a and t1.c=t.c) from t"). Check(testkit.Rows( "Projection_8 10.00 root concat(t1.a, \",\", t1.b)", - "└─Apply_10 10.00 root CARTESIAN left outer join, inner:MaxOneRow_13", + "└─Apply_10 10.00 root CARTESIAN left outer join, inner:MaxOneRow_15", " ├─TableReader_12 10.00 root data:TableScan_11", " │ └─TableScan_11 10.00 cop table:t, range:[-inf,+inf], keep order:false", " └─MaxOneRow_13 1.00 root ", @@ -915,13 +915,13 @@ func (s *testAnalyzeSuite) TestIssue9562(c *C) { tk.MustExec("create table t(a int, b int, index idx_ab(a, b))") tk.MustQuery("explain select * from t t1 join t t2 where t1.b = t2.b and t2.b is null").Check(testkit.Rows( "Projection_7 0.00 root test.t1.a, test.t1.b, test.t2.a, test.t2.b", - "└─HashRightJoin_9 0.00 root inner join, inner:TableReader_12, equal:[eq(test.t2.b, test.t1.b)]", - " ├─TableReader_12 0.00 root data:Selection_11", - " │ └─Selection_11 0.00 cop isnull(test.t2.b), not(isnull(test.t2.b))", - " │ └─TableScan_10 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo", - " └─TableReader_15 9990.00 root data:Selection_14", - " └─Selection_14 9990.00 cop not(isnull(test.t1.b))", - " └─TableScan_13 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo", + "└─HashRightJoin_9 0.00 root inner join, inner:IndexReader_15, equal:[eq(test.t2.b, test.t1.b)]", + " ├─IndexReader_15 0.00 root index:Selection_14", + " │ └─Selection_14 0.00 cop isnull(test.t2.b), not(isnull(test.t2.b))", + " │ └─IndexScan_13 10000.00 cop table:t2, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo", + " └─IndexReader_21 9990.00 root index:Selection_20", + " └─Selection_20 9990.00 cop not(isnull(test.t1.b))", + " └─IndexScan_19 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo", )) } diff --git a/planner/core/find_best_task.go b/planner/core/find_best_task.go index 40e20ea43287d..a025c809634ae 100644 --- a/planner/core/find_best_task.go +++ b/planner/core/find_best_task.go @@ -305,11 +305,12 @@ func (ds *DataSource) skylinePruning(prop *property.PhysicalProperty) []*candida var currentCandidate *candidatePath if path.isTablePath { currentCandidate = ds.getTableCandidate(path, prop) - } else if len(path.accessConds) > 0 || !prop.IsEmpty() || path.forced { - // We will use index to generate physical plan if: - // this path's access cond is not nil or - // we have prop to match or - // this index is forced to choose. + } else if len(path.accessConds) > 0 || !prop.IsEmpty() || path.forced || isCoveringIndex(ds.schema.Columns, path.fullIdxCols, path.fullIdxColLens, ds.tableInfo.PKIsHandle) { + // We will use index to generate physical plan if any of the following conditions is satisfied: + // 1. This path's access cond is not nil. + // 2. We have a non-empty prop to match. + // 3. This index is forced to choose. + // 4. The needed columns are all covered by index columns(and handleCol). currentCandidate = ds.getIndexCandidate(path, prop) } else { continue diff --git a/planner/core/logical_plan_test.go b/planner/core/logical_plan_test.go index 264cf7745b8e2..dc20ba333fd7b 100644 --- a/planner/core/logical_plan_test.go +++ b/planner/core/logical_plan_test.go @@ -2237,7 +2237,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select a, avg(a+1) over(partition by (a+1)) from t", - result: "TableReader(Table(t))->Projection->Sort->Window(avg(cast(2_proj_window_3)) over(partition by 2_proj_window_2))->Projection", + result: "IndexReader(Index(t.f)[[NULL,+inf]])->Projection->Sort->Window(avg(cast(2_proj_window_3)) over(partition by 2_proj_window_2))->Projection", }, { sql: "select a, avg(a) over(order by a asc, b desc) from t order by a asc, b desc", @@ -2257,7 +2257,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select sum(avg(a)) over() from t", - result: "TableReader(Table(t)->StreamAgg)->StreamAgg->Window(sum(sel_agg_2) over())->Projection", + result: "IndexReader(Index(t.f)[[NULL,+inf]]->StreamAgg)->StreamAgg->Window(sum(sel_agg_2) over())->Projection", }, { sql: "select b from t order by(sum(a) over())", @@ -2273,7 +2273,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select a from t having (select sum(a) over() as w from t tt where a > t.a)", - result: "Apply{TableReader(Table(t))->TableReader(Table(t)->Sel([gt(test.tt.a, test.t.a)]))->Window(sum(cast(test.tt.a)) over())->MaxOneRow->Sel([w])}->Projection", + result: "Apply{IndexReader(Index(t.f)[[NULL,+inf]])->IndexReader(Index(t.f)[[NULL,+inf]]->Sel([gt(test.tt.a, test.t.a)]))->Window(sum(cast(test.tt.a)) over())->MaxOneRow->Sel([w])}->Projection", }, { sql: "select avg(a) over() as w from t having w > 1", @@ -2305,7 +2305,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select sum(a) over w from t window w as (rows between 1 preceding AND 1 following)", - result: "TableReader(Table(t))->Window(sum(cast(test.t.a)) over(rows between 1 preceding and 1 following))->Projection", + result: "IndexReader(Index(t.f)[[NULL,+inf]])->Window(sum(cast(test.t.a)) over(rows between 1 preceding and 1 following))->Projection", }, { sql: "select sum(a) over(w order by b) from t window w as (order by a)", @@ -2373,7 +2373,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select row_number() over(rows between 1 preceding and 1 following) from t", - result: "TableReader(Table(t))->Window(row_number() over())->Projection", + result: "IndexReader(Index(t.f)[[NULL,+inf]])->Window(row_number() over())->Projection", }, { sql: "select avg(b), max(avg(b)) over(rows between 1 preceding and 1 following) max from t group by c", @@ -2397,7 +2397,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select ntile(null) over() from t", - result: "TableReader(Table(t))->Window(ntile() over())->Projection", + result: "IndexReader(Index(t.f)[[NULL,+inf]])->Window(ntile() over())->Projection", }, { sql: "select avg(a) over w from t window w as(partition by b)", @@ -2572,6 +2572,10 @@ func (s *testPlanSuite) TestSkylinePruning(c *C) { sql: "select * from t where f > 1 and g > 1", result: "PRIMARY_KEY,f,g,f_g", }, + { + sql: "select count(1) from t", + result: "PRIMARY_KEY,c_d_e,f,g,f_g,c_d_e_str,e_d_c_str_prefix", + }, } ctx := context.TODO() for i, tt := range tests { diff --git a/planner/core/physical_plan_test.go b/planner/core/physical_plan_test.go index 91df45c2a73dc..206e697d705cc 100644 --- a/planner/core/physical_plan_test.go +++ b/planner/core/physical_plan_test.go @@ -122,7 +122,7 @@ func (s *testPlanSuite) TestDAGPlanBuilderSimpleCase(c *C) { // Test Limit push down in table single read. { sql: "select c from t limit 1", - best: "TableReader(Table(t)->Limit)->Limit", + best: "IndexReader(Index(t.c_d_e)[[NULL,+inf]]->Limit)->Limit", }, // Test Limit push down in index single read. { @@ -208,7 +208,7 @@ func (s *testPlanSuite) TestDAGPlanBuilderSimpleCase(c *C) { }, { sql: "select lead(a, 1) over (partition by null) as c from t", - best: "TableReader(Table(t))->Window(lead(test.t.a, 1) over())->Projection", + best: "IndexReader(Index(t.f)[[NULL,+inf]])->Window(lead(test.t.a, 1) over())->Projection", }, } for i, tt := range tests { @@ -300,7 +300,7 @@ func (s *testPlanSuite) TestDAGPlanBuilderJoin(c *C) { }, { sql: "select t.c in (select b from t s where s.a = t.a) from t", - best: "MergeLeftOuterSemiJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.a,test.s.a)->Projection", + best: "LeftHashJoin{IndexReader(Index(t.c_d_e)[[NULL,+inf]])->TableReader(Table(t))}(test.t.a,test.s.a)(test.t.c,test.s.b)->Projection", }, // Test Single Merge Join. // Merge Join now enforce a sort. @@ -485,11 +485,11 @@ func (s *testPlanSuite) TestDAGPlanBuilderSubquery(c *C) { // Test join key with cast. { sql: "select * from t where exists (select s.a from t s having sum(s.a) = t.a )", - best: "LeftHashJoin{TableReader(Table(t))->Projection->TableReader(Table(t)->StreamAgg)->StreamAgg}(cast(test.t.a),sel_agg_1)->Projection", + best: "LeftHashJoin{TableReader(Table(t))->Projection->IndexReader(Index(t.f)[[NULL,+inf]]->StreamAgg)->StreamAgg}(cast(test.t.a),sel_agg_1)->Projection", }, { sql: "select * from t where exists (select s.a from t s having sum(s.a) = t.a ) order by t.a", - best: "LeftHashJoin{TableReader(Table(t))->Projection->TableReader(Table(t)->StreamAgg)->StreamAgg}(cast(test.t.a),sel_agg_1)->Projection->Sort", + best: "LeftHashJoin{TableReader(Table(t))->Projection->IndexReader(Index(t.f)[[NULL,+inf]]->StreamAgg)->StreamAgg}(cast(test.t.a),sel_agg_1)->Projection->Sort", }, // FIXME: Report error by resolver. //{ @@ -508,7 +508,7 @@ func (s *testPlanSuite) TestDAGPlanBuilderSubquery(c *C) { // Test Semi Join + Order by. { sql: "select * from t where a in (select a from t) order by b", - best: "MergeInnerJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.a,test.t.a)->Projection->Sort", + best: "LeftHashJoin{TableReader(Table(t))->IndexReader(Index(t.f)[[NULL,+inf]])}(test.t.a,test.t.a)->Projection->Sort", }, // Test Apply. { @@ -961,7 +961,7 @@ func (s *testPlanSuite) TestDAGPlanBuilderAgg(c *C) { }, { sql: "select sum(d) from t", - best: "TableReader(Table(t)->StreamAgg)->StreamAgg", + best: "IndexReader(Index(t.c_d_e)[[NULL,+inf]]->StreamAgg)->StreamAgg", }, } for _, tt := range tests { @@ -1022,7 +1022,7 @@ func (s *testPlanSuite) TestRefine(c *C) { }, { sql: "select a from t where d <= 5 and d > 3", - best: "TableReader(Table(t)->Sel([le(test.t.d, 5) gt(test.t.d, 3)]))->Projection", + best: "IndexReader(Index(t.c_d_e)[[NULL,+inf]]->Sel([le(test.t.d, 5) gt(test.t.d, 3)]))->Projection", }, { sql: "select a from t where c between 1 and 2", @@ -1054,7 +1054,7 @@ func (s *testPlanSuite) TestRefine(c *C) { }, { sql: "select a from t where not a", - best: "TableReader(Table(t)->Sel([not(test.t.a)]))", + best: "IndexReader(Index(t.f)[[NULL,+inf]]->Sel([not(test.t.a)]))", }, { sql: "select a from t where c in (1)", @@ -1090,7 +1090,7 @@ func (s *testPlanSuite) TestRefine(c *C) { }, { sql: "select a from t where d in (1, 2, 3)", - best: "TableReader(Table(t)->Sel([in(test.t.d, 1, 2, 3)]))->Projection", + best: "IndexReader(Index(t.c_d_e)[[NULL,+inf]]->Sel([in(test.t.d, 1, 2, 3)]))->Projection", }, { sql: "select a from t where c not in (1)", @@ -1119,7 +1119,7 @@ func (s *testPlanSuite) TestRefine(c *C) { }, { sql: "select a from t where c_str like '_abc'", - best: "TableReader(Table(t)->Sel([like(test.t.c_str, _abc, 92)]))->Projection", + best: "IndexReader(Index(t.c_d_e_str)[[NULL,+inf]]->Sel([like(test.t.c_str, _abc, 92)]))->Projection", }, { sql: `select a from t where c_str like 'abc%'`, @@ -1188,7 +1188,7 @@ func (s *testPlanSuite) TestRefine(c *C) { }, { sql: `select a from t where c = 'hanfei'`, - best: "TableReader(Table(t))->Sel([eq(cast(test.t.c), cast(hanfei))])->Projection", + best: "IndexReader(Index(t.c_d_e)[[NULL,+inf]])->Sel([eq(cast(test.t.c), cast(hanfei))])->Projection", }, } for _, tt := range tests { @@ -1243,12 +1243,12 @@ func (s *testPlanSuite) TestAggEliminater(c *C) { // If max/min contains scalar function, we can still do transformation. { sql: "select max(a+1) from t;", - best: "TableReader(Table(t)->Sel([not(isnull(plus(test.t.a, 1)))])->TopN([plus(test.t.a, 1) true],0,1))->Projection->TopN([col_1 true],0,1)->Projection->Projection->StreamAgg", + best: "IndexReader(Index(t.f)[[NULL,+inf]]->Sel([not(isnull(plus(test.t.a, 1)))])->TopN([plus(test.t.a, 1) true],0,1))->Projection->TopN([col_1 true],0,1)->Projection->Projection->StreamAgg", }, // Do nothing to max+min. { sql: "select max(a), min(a) from t;", - best: "TableReader(Table(t)->StreamAgg)->StreamAgg", + best: "IndexReader(Index(t.f)[[NULL,+inf]]->StreamAgg)->StreamAgg", }, // Do nothing to max with groupby. { diff --git a/session/session_test.go b/session/session_test.go index bd44b6851ca13..1d260a16f922b 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -857,35 +857,35 @@ func (s *testSessionSuite) TestAutoIncrementID(c *C) { tk.MustQuery("select * from autoid").Check(testkit.Rows("1", "5000")) _, err = tk.Exec("update autoid set auto_inc_id = 8000") c.Assert(terror.ErrorEqual(err, kv.ErrKeyExists), IsTrue) - tk.MustQuery("select * from autoid").Check(testkit.Rows("1", "5000")) + tk.MustQuery("select * from autoid use index()").Check(testkit.Rows("1", "5000")) tk.MustExec("update autoid set auto_inc_id = 9000 where auto_inc_id=1") - tk.MustQuery("select * from autoid").Check(testkit.Rows("9000", "5000")) + tk.MustQuery("select * from autoid use index()").Check(testkit.Rows("9000", "5000")) tk.MustExec("insert into autoid values()") - tk.MustQuery("select * from autoid").Check(testkit.Rows("9000", "5000", "9001")) + tk.MustQuery("select * from autoid use index()").Check(testkit.Rows("9000", "5000", "9001")) // Corner cases for signed bigint auto_increment Columns. tk.MustExec("drop table if exists autoid") tk.MustExec("create table autoid(`auto_inc_id` bigint(20) NOT NULL AUTO_INCREMENT,UNIQUE KEY `auto_inc_id` (`auto_inc_id`))") tk.MustExec("insert into autoid values(9223372036854775806);") - tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid").Check(testkit.Rows("9223372036854775806 9223372036854775807")) + tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid use index()").Check(testkit.Rows("9223372036854775806 9223372036854775807")) _, err = tk.Exec("insert into autoid values();") c.Assert(terror.ErrorEqual(err, autoid.ErrAutoincReadFailed), IsTrue) - tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid").Check(testkit.Rows("9223372036854775806 9223372036854775807")) + tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid use index()").Check(testkit.Rows("9223372036854775806 9223372036854775807")) tk.MustQuery("select auto_inc_id, _tidb_rowid from autoid use index(auto_inc_id)").Check(testkit.Rows("9223372036854775806 9223372036854775807")) tk.MustExec("drop table if exists autoid") tk.MustExec("create table autoid(`auto_inc_id` bigint(20) NOT NULL AUTO_INCREMENT,UNIQUE KEY `auto_inc_id` (`auto_inc_id`))") tk.MustExec("insert into autoid values()") - tk.MustQuery("select * from autoid").Check(testkit.Rows("1")) + tk.MustQuery("select * from autoid use index()").Check(testkit.Rows("1")) tk.MustExec("insert into autoid values(5000)") - tk.MustQuery("select * from autoid").Check(testkit.Rows("1", "5000")) + tk.MustQuery("select * from autoid use index()").Check(testkit.Rows("1", "5000")) _, err = tk.Exec("update autoid set auto_inc_id = 8000") c.Assert(terror.ErrorEqual(err, kv.ErrKeyExists), IsTrue) - tk.MustQuery("select * from autoid").Check(testkit.Rows("1", "5000")) + tk.MustQuery("select * from autoid use index()").Check(testkit.Rows("1", "5000")) tk.MustExec("update autoid set auto_inc_id = 9000 where auto_inc_id=1") - tk.MustQuery("select * from autoid").Check(testkit.Rows("9000", "5000")) + tk.MustQuery("select * from autoid use index()").Check(testkit.Rows("9000", "5000")) tk.MustExec("insert into autoid values()") - tk.MustQuery("select * from autoid").Check(testkit.Rows("9000", "5000", "9001")) + tk.MustQuery("select * from autoid use index()").Check(testkit.Rows("9000", "5000", "9001")) } func (s *testSessionSuite) TestAutoIncrementWithRetry(c *C) { diff --git a/util/admin/admin.go b/util/admin/admin.go index 4a830342a5f85..a580edbb61bae 100644 --- a/util/admin/admin.go +++ b/util/admin/admin.go @@ -282,7 +282,7 @@ const ( // otherwise it returns an error and the corresponding index's offset. func CheckIndicesCount(ctx sessionctx.Context, dbName, tableName string, indices []string) (byte, int, error) { // Add `` for some names like `table name`. - sql := fmt.Sprintf("SELECT COUNT(*) FROM `%s`.`%s`", dbName, tableName) + sql := fmt.Sprintf("SELECT COUNT(*) FROM `%s`.`%s` USE INDEX()", dbName, tableName) tblCnt, err := getCount(ctx, sql) if err != nil { return 0, 0, errors.Trace(err) diff --git a/util/ranger/ranger_test.go b/util/ranger/ranger_test.go index c426dcdefa32c..2f4d465586b65 100644 --- a/util/ranger/ranger_test.go +++ b/util/ranger/ranger_test.go @@ -1106,11 +1106,11 @@ func (s *testRangerSuite) TestCompIndexInExprCorrCol(c *C) { " ├─TableReader_15 2.00 root data:TableScan_14", " │ └─TableScan_14 2.00 cop table:t, range:[-inf,+inf], keep order:false", " └─StreamAgg_20 1.00 root funcs:count(1)", - " └─IndexJoin_32 2.00 root inner join, inner:TableReader_31, outer key:test.s.a, inner key:test.t1.a", - " ├─IndexReader_27 2.00 root index:IndexScan_26", - " │ └─IndexScan_26 2.00 cop table:s, index:b, c, d, range: decided by [eq(test.s.b, 1) in(test.s.c, 1, 2) eq(test.s.d, test.t.a)], keep order:false", - " └─TableReader_31 1.00 root data:TableScan_30", - " └─TableScan_30 1.00 cop table:t1, range: decided by [test.s.a], keep order:false", + " └─IndexMergeJoin_42 2.00 root inner join, inner:TableReader_40, outer key:test.s.a, inner key:test.t1.a", + " ├─IndexReader_31 2.00 root index:IndexScan_30", + " │ └─IndexScan_30 2.00 cop table:s, index:b, c, d, range: decided by [eq(test.s.b, 1) in(test.s.c, 1, 2) eq(test.s.d, test.t.a)], keep order:false", + " └─TableReader_40 1.00 root data:TableScan_39", + " └─TableScan_39 1.00 cop table:t1, range: decided by [test.s.a], keep order:true", )) testKit.MustQuery("select t.e in (select count(*) from t s use index(idx), t t1 where s.b = 1 and s.c in (1, 2) and s.d = t.a and s.a = t1.a) from t").Check(testkit.Rows( "1", From 84aadd8568bdfdacd2ab15bfcf63773237f0ece4 Mon Sep 17 00:00:00 2001 From: francis0407 Date: Tue, 10 Sep 2019 11:33:57 +0800 Subject: [PATCH 2/7] change skylinePrune & fix tests --- .../r/access_path_selection.result | 6 +- cmd/explaintest/r/explain_easy.result | 164 +-- cmd/explaintest/r/explain_easy_stats.result | 46 +- cmd/explaintest/r/generated_columns.result | 6 +- cmd/explaintest/r/partition_pruning.result | 1184 ++++++++--------- cmd/explaintest/r/select.result | 26 +- cmd/explaintest/r/subquery.result | 6 +- cmd/explaintest/r/topn_push_down.result | 28 +- cmd/explaintest/r/window_function.result | 4 +- planner/core/cbo_test.go | 38 +- planner/core/find_best_task.go | 28 +- planner/core/logical_plan_test.go | 14 +- planner/core/physical_plan_test.go | 34 +- 13 files changed, 803 insertions(+), 781 deletions(-) diff --git a/cmd/explaintest/r/access_path_selection.result b/cmd/explaintest/r/access_path_selection.result index 3e857d0b1d028..d178e09f8e03c 100644 --- a/cmd/explaintest/r/access_path_selection.result +++ b/cmd/explaintest/r/access_path_selection.result @@ -15,9 +15,9 @@ IndexReader_6 3323.33 root index:IndexScan_5 └─IndexScan_5 3323.33 cop table:access_path_selection, index:a, b, range:[-inf,3), keep order:false, stats:pseudo explain select a, b from access_path_selection where b < 3; id count task operator info -IndexLookUp_10 3323.33 root -├─IndexScan_8 3323.33 cop table:access_path_selection, index:b, range:[-inf,3), keep order:false, stats:pseudo -└─TableScan_9 3323.33 cop table:access_path_selection, keep order:false, stats:pseudo +IndexLookUp_7 3323.33 root +├─IndexScan_5 3323.33 cop table:access_path_selection, index:b, range:[-inf,3), keep order:false, stats:pseudo +└─TableScan_6 3323.33 cop table:access_path_selection, keep order:false, stats:pseudo explain select a, b from access_path_selection where a < 3 and b < 3; id count task operator info IndexReader_11 1104.45 root index:Selection_10 diff --git a/cmd/explaintest/r/explain_easy.result b/cmd/explaintest/r/explain_easy.result index dbfed027cef57..2c9ed5f634306 100644 --- a/cmd/explaintest/r/explain_easy.result +++ b/cmd/explaintest/r/explain_easy.result @@ -89,12 +89,12 @@ TableReader_7 0.33 root data:Selection_6 explain select sum(t1.c1 in (select c1 from t2)) from t1; id count task operator info StreamAgg_12 1.00 root funcs:sum(col_0) -└─Projection_23 10000.00 root cast(5_aux_0) - └─HashLeftJoin_22 10000.00 root CARTESIAN left outer semi join, inner:IndexReader_21, other cond:eq(test.t1.c1, test.t2.c1) - ├─IndexReader_17 10000.00 root index:IndexScan_16 - │ └─IndexScan_16 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo - └─IndexReader_21 10000.00 root index:IndexScan_20 - └─IndexScan_20 10000.00 cop table:t2, index:c1, range:[NULL,+inf], keep order:false, stats:pseudo +└─Projection_19 10000.00 root cast(5_aux_0) + └─HashLeftJoin_18 10000.00 root CARTESIAN left outer semi join, inner:IndexReader_17, other cond:eq(test.t1.c1, test.t2.c1) + ├─IndexReader_15 10000.00 root index:IndexScan_14 + │ └─IndexScan_14 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexReader_17 10000.00 root index:IndexScan_16 + └─IndexScan_16 10000.00 cop table:t2, index:c1, range:[NULL,+inf], keep order:false, stats:pseudo explain select c1 from t1 where c1 in (select c2 from t2); id count task operator info Projection_9 9990.00 root test.t1.c1 @@ -122,15 +122,15 @@ MemTableScan_4 10000.00 root explain select c2 = (select c2 from t2 where t1.c1 = t2.c1 order by c1 limit 1) from t1; id count task operator info Projection_12 10000.00 root eq(test.t1.c2, test.t2.c2) -└─Apply_14 10000.00 root CARTESIAN left outer join, inner:Limit_23 - ├─IndexReader_18 10000.00 root index:IndexScan_17 - │ └─IndexScan_17 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo - └─Limit_23 1.00 root offset:0, count:1 - └─Projection_43 1.00 root test.t2.c1, test.t2.c2 - └─IndexLookUp_42 1.00 root - ├─Limit_41 1.00 cop offset:0, count:1 - │ └─IndexScan_39 1.00 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true, stats:pseudo - └─TableScan_40 1.00 cop table:t2, keep order:false, stats:pseudo +└─Apply_14 10000.00 root CARTESIAN left outer join, inner:Limit_21 + ├─IndexReader_16 10000.00 root index:IndexScan_15 + │ └─IndexScan_15 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─Limit_21 1.00 root offset:0, count:1 + └─Projection_41 1.00 root test.t2.c1, test.t2.c2 + └─IndexLookUp_40 1.00 root + ├─Limit_39 1.00 cop offset:0, count:1 + │ └─IndexScan_37 1.00 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true, stats:pseudo + └─TableScan_38 1.00 cop table:t2, keep order:false, stats:pseudo explain select * from t1 order by c1 desc limit 1; id count task operator info Limit_10 1.00 root offset:0, count:1 @@ -155,12 +155,12 @@ Limit_8 1.00 root offset:0, count:1 └─TableScan_11 3.00 cop table:t4, range:(1,+inf], keep order:false, stats:pseudo explain select ifnull(null, t1.c1) from t1; id count task operator info -IndexReader_7 10000.00 root index:IndexScan_6 -└─IndexScan_6 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_5 10000.00 root index:IndexScan_4 +└─IndexScan_4 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo explain select if(10, t1.c1, t1.c2) from t1; id count task operator info -IndexReader_7 10000.00 root index:IndexScan_6 -└─IndexScan_6 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_5 10000.00 root index:IndexScan_4 +└─IndexScan_4 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo explain select c1 from t2 union select c1 from t2 union all select c1 from t2; id count task operator info Union_17 26000.00 root @@ -174,8 +174,8 @@ Union_17 26000.00 root │ └─IndexReader_50 8000.00 root index:StreamAgg_41 │ └─StreamAgg_41 8000.00 cop group by:test.t2.c1, funcs:firstrow(test.t2.c1), firstrow(test.t2.c1) │ └─IndexScan_48 10000.00 cop table:t2, index:c1, range:[NULL,+inf], keep order:true, stats:pseudo -└─TableReader_55 10000.00 root data:TableScan_54 - └─TableScan_54 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo +└─IndexReader_55 10000.00 root index:IndexScan_54 + └─IndexScan_54 10000.00 cop table:t2, index:c1, range:[NULL,+inf], keep order:false, stats:pseudo explain select c1 from t2 union all select c1 from t2 union select c1 from t2; id count task operator info HashAgg_18 24000.00 root group by:c1, funcs:firstrow(join_agg_0) @@ -203,17 +203,17 @@ StreamAgg_13 1.00 root funcs:count(1) explain select 1 from (select count(c2), count(c3) from t1) k; id count task operator info Projection_5 1.00 root 1 -└─StreamAgg_21 1.00 root funcs:firstrow(col_0) - └─IndexReader_22 1.00 root index:StreamAgg_9 +└─StreamAgg_17 1.00 root funcs:firstrow(col_0) + └─IndexReader_18 1.00 root index:StreamAgg_9 └─StreamAgg_9 1.00 cop funcs:firstrow(1) - └─IndexScan_20 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexScan_16 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo explain select count(1) from (select max(c2), count(c3) as m from t1) k; id count task operator info StreamAgg_11 1.00 root funcs:count(1) -└─StreamAgg_27 1.00 root funcs:firstrow(col_0) - └─IndexReader_28 1.00 root index:StreamAgg_15 +└─StreamAgg_23 1.00 root funcs:firstrow(col_0) + └─IndexReader_24 1.00 root index:StreamAgg_15 └─StreamAgg_15 1.00 cop funcs:firstrow(1) - └─IndexScan_26 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexScan_22 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo explain select count(1) from (select count(c2) from t1 group by c3) k; id count task operator info StreamAgg_11 1.00 root funcs:count(1) @@ -225,31 +225,31 @@ set @@session.tidb_opt_insubq_to_join_and_agg=0; explain select sum(t1.c1 in (select c1 from t2)) from t1; id count task operator info StreamAgg_12 1.00 root funcs:sum(col_0) -└─Projection_23 10000.00 root cast(5_aux_0) - └─HashLeftJoin_22 10000.00 root CARTESIAN left outer semi join, inner:IndexReader_21, other cond:eq(test.t1.c1, test.t2.c1) - ├─IndexReader_17 10000.00 root index:IndexScan_16 - │ └─IndexScan_16 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo - └─IndexReader_21 10000.00 root index:IndexScan_20 - └─IndexScan_20 10000.00 cop table:t2, index:c1, range:[NULL,+inf], keep order:false, stats:pseudo +└─Projection_19 10000.00 root cast(5_aux_0) + └─HashLeftJoin_18 10000.00 root CARTESIAN left outer semi join, inner:IndexReader_17, other cond:eq(test.t1.c1, test.t2.c1) + ├─IndexReader_15 10000.00 root index:IndexScan_14 + │ └─IndexScan_14 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexReader_17 10000.00 root index:IndexScan_16 + └─IndexScan_16 10000.00 cop table:t2, index:c1, range:[NULL,+inf], keep order:false, stats:pseudo explain select 1 in (select c2 from t2) from t1; id count task operator info Projection_6 10000.00 root 5_aux_0 -└─HashLeftJoin_7 10000.00 root CARTESIAN left outer semi join, inner:TableReader_14 - ├─IndexReader_11 10000.00 root index:IndexScan_10 - │ └─IndexScan_10 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo - └─TableReader_14 10.00 root data:Selection_13 - └─Selection_13 10.00 cop eq(1, test.t2.c2) - └─TableScan_12 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo +└─HashLeftJoin_7 10000.00 root CARTESIAN left outer semi join, inner:TableReader_12 + ├─IndexReader_9 10000.00 root index:IndexScan_8 + │ └─IndexScan_8 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─TableReader_12 10.00 root data:Selection_11 + └─Selection_11 10.00 cop eq(1, test.t2.c2) + └─TableScan_10 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo explain select sum(6 in (select c2 from t2)) from t1; id count task operator info StreamAgg_12 1.00 root funcs:sum(col_0) -└─Projection_22 10000.00 root cast(5_aux_0) - └─HashLeftJoin_21 10000.00 root CARTESIAN left outer semi join, inner:TableReader_20 - ├─IndexReader_17 10000.00 root index:IndexScan_16 - │ └─IndexScan_16 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo - └─TableReader_20 10.00 root data:Selection_19 - └─Selection_19 10.00 cop eq(6, test.t2.c2) - └─TableScan_18 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo +└─Projection_20 10000.00 root cast(5_aux_0) + └─HashLeftJoin_19 10000.00 root CARTESIAN left outer semi join, inner:TableReader_18 + ├─IndexReader_15 10000.00 root index:IndexScan_14 + │ └─IndexScan_14 10000.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false, stats:pseudo + └─TableReader_18 10.00 root data:Selection_17 + └─Selection_17 10.00 cop eq(6, test.t2.c2) + └─TableScan_16 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo explain format="dot" select sum(t1.c1 in (select c1 from t2)) from t1; dot contents @@ -258,25 +258,25 @@ subgraph cluster12{ node [style=filled, color=lightgrey] color=black label = "root" -"StreamAgg_12" -> "Projection_23" -"Projection_23" -> "HashLeftJoin_22" -"HashLeftJoin_22" -> "IndexReader_17" -"HashLeftJoin_22" -> "IndexReader_21" +"StreamAgg_12" -> "Projection_19" +"Projection_19" -> "HashLeftJoin_18" +"HashLeftJoin_18" -> "IndexReader_15" +"HashLeftJoin_18" -> "IndexReader_17" } -subgraph cluster16{ +subgraph cluster14{ node [style=filled, color=lightgrey] color=black label = "cop" -"IndexScan_16" +"IndexScan_14" } -subgraph cluster20{ +subgraph cluster16{ node [style=filled, color=lightgrey] color=black label = "cop" -"IndexScan_20" +"IndexScan_16" } +"IndexReader_15" -> "IndexScan_14" "IndexReader_17" -> "IndexScan_16" -"IndexReader_21" -> "IndexScan_20" } explain format="dot" select 1 in (select c2 from t2) from t1; @@ -288,23 +288,23 @@ node [style=filled, color=lightgrey] color=black label = "root" "Projection_6" -> "HashLeftJoin_7" -"HashLeftJoin_7" -> "IndexReader_11" -"HashLeftJoin_7" -> "TableReader_14" +"HashLeftJoin_7" -> "IndexReader_9" +"HashLeftJoin_7" -> "TableReader_12" } -subgraph cluster10{ +subgraph cluster8{ node [style=filled, color=lightgrey] color=black label = "cop" -"IndexScan_10" +"IndexScan_8" } -subgraph cluster13{ +subgraph cluster11{ node [style=filled, color=lightgrey] color=black label = "cop" -"Selection_13" -> "TableScan_12" +"Selection_11" -> "TableScan_10" } -"IndexReader_11" -> "IndexScan_10" -"TableReader_14" -> "Selection_13" +"IndexReader_9" -> "IndexScan_8" +"TableReader_12" -> "Selection_11" } drop table if exists t1, t2, t3, t4; @@ -423,9 +423,9 @@ IndexReader_6 10.00 root index:IndexScan_5 └─IndexScan_5 10.00 cop table:t, index:a, b, range:[1,1], keep order:false, stats:pseudo explain select * from t where b in (1, 2) and b in (1, 3); id count task operator info -IndexReader_10 10.00 root index:Selection_9 -└─Selection_9 10.00 cop eq(test.t.b, 1) - └─IndexScan_8 10000.00 cop table:t, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_7 10.00 root index:Selection_6 +└─Selection_6 10.00 cop eq(test.t.b, 1) + └─IndexScan_5 10000.00 cop table:t, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo explain select * from t where a = 1 and a = 1; id count task operator info IndexReader_6 10.00 root index:IndexScan_5 @@ -439,20 +439,20 @@ TableDual_5 0.00 root rows:0 explain select * from t t1 join t t2 where t1.b = t2.b and t2.b is null; id count task operator info Projection_7 0.00 root test.t1.a, test.t1.b, test.t2.a, test.t2.b -└─HashRightJoin_9 0.00 root inner join, inner:IndexReader_15, equal:[eq(test.t2.b, test.t1.b)] - ├─IndexReader_15 0.00 root index:Selection_14 - │ └─Selection_14 0.00 cop isnull(test.t2.b), not(isnull(test.t2.b)) - │ └─IndexScan_13 10000.00 cop table:t2, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo - └─IndexReader_21 9990.00 root index:Selection_20 - └─Selection_20 9990.00 cop not(isnull(test.t1.b)) - └─IndexScan_19 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─HashRightJoin_9 0.00 root inner join, inner:IndexReader_12, equal:[eq(test.t2.b, test.t1.b)] + ├─IndexReader_12 0.00 root index:Selection_11 + │ └─Selection_11 0.00 cop isnull(test.t2.b), not(isnull(test.t2.b)) + │ └─IndexScan_10 10000.00 cop table:t2, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexReader_15 9990.00 root index:Selection_14 + └─Selection_14 9990.00 cop not(isnull(test.t1.b)) + └─IndexScan_13 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo explain select * from t t1 where not exists (select * from t t2 where t1.b = t2.b); id count task operator info -HashLeftJoin_9 8000.00 root anti semi join, inner:IndexReader_17, equal:[eq(test.t1.b, test.t2.b)] -├─IndexReader_13 10000.00 root index:IndexScan_12 -│ └─IndexScan_12 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_17 10000.00 root index:IndexScan_16 - └─IndexScan_16 10000.00 cop table:t2, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +HashLeftJoin_9 8000.00 root anti semi join, inner:IndexReader_13, equal:[eq(test.t1.b, test.t2.b)] +├─IndexReader_11 10000.00 root index:IndexScan_10 +│ └─IndexScan_10 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_13 10000.00 root index:IndexScan_12 + └─IndexScan_12 10000.00 cop table:t2, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo drop table if exists t; create table t(a bigint primary key); explain select * from t where a = 1 and a = 2; @@ -484,12 +484,12 @@ create table t1(a int, b int, c int, primary key(a, b)); create table t2(a int, b int, c int, primary key(a)); explain select t1.a, t1.b from t1 left outer join t2 on t1.a = t2.a; id count task operator info -IndexReader_9 10000.00 root index:IndexScan_8 -└─IndexScan_8 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_7 10000.00 root index:IndexScan_6 +└─IndexScan_6 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo explain select distinct t1.a, t1.b from t1 left outer join t2 on t1.a = t2.a; id count task operator info -IndexReader_11 10000.00 root index:IndexScan_10 -└─IndexScan_10 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_9 10000.00 root index:IndexScan_8 +└─IndexScan_8 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo drop table if exists t; create table t(a int, nb int not null, nc int not null); explain select ifnull(a, 0) from t; diff --git a/cmd/explaintest/r/explain_easy_stats.result b/cmd/explaintest/r/explain_easy_stats.result index 19c9355b9f9d2..9c82b0923467a 100644 --- a/cmd/explaintest/r/explain_easy_stats.result +++ b/cmd/explaintest/r/explain_easy_stats.result @@ -108,15 +108,15 @@ MemTableScan_4 10000.00 root explain select c2 = (select c2 from t2 where t1.c1 = t2.c1 order by c1 limit 1) from t1; id count task operator info Projection_12 1999.00 root eq(test.t1.c2, test.t2.c2) -└─Apply_14 1999.00 root CARTESIAN left outer join, inner:Limit_23 - ├─IndexReader_18 1999.00 root index:IndexScan_17 - │ └─IndexScan_17 1999.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false - └─Limit_23 1.00 root offset:0, count:1 - └─Projection_43 1.00 root test.t2.c1, test.t2.c2 - └─IndexLookUp_42 1.00 root - ├─Limit_41 1.00 cop offset:0, count:1 - │ └─IndexScan_39 1.25 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true - └─TableScan_40 1.00 cop table:t2, keep order:false, stats:pseudo +└─Apply_14 1999.00 root CARTESIAN left outer join, inner:Limit_21 + ├─IndexReader_16 1999.00 root index:IndexScan_15 + │ └─IndexScan_15 1999.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false + └─Limit_21 1.00 root offset:0, count:1 + └─Projection_41 1.00 root test.t2.c1, test.t2.c2 + └─IndexLookUp_40 1.00 root + ├─Limit_39 1.00 cop offset:0, count:1 + │ └─IndexScan_37 1.25 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true + └─TableScan_38 1.00 cop table:t2, keep order:false, stats:pseudo explain select * from t1 order by c1 desc limit 1; id count task operator info Limit_10 1.00 root offset:0, count:1 @@ -127,12 +127,12 @@ set @@session.tidb_opt_insubq_to_join_and_agg=0; explain select 1 in (select c2 from t2) from t1; id count task operator info Projection_6 1999.00 root 5_aux_0 -└─HashLeftJoin_7 1999.00 root CARTESIAN left outer semi join, inner:TableReader_14 - ├─IndexReader_11 1999.00 root index:IndexScan_10 - │ └─IndexScan_10 1999.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false - └─TableReader_14 0.00 root data:Selection_13 - └─Selection_13 0.00 cop eq(1, test.t2.c2) - └─TableScan_12 1985.00 cop table:t2, range:[-inf,+inf], keep order:false +└─HashLeftJoin_7 1999.00 root CARTESIAN left outer semi join, inner:TableReader_12 + ├─IndexReader_9 1999.00 root index:IndexScan_8 + │ └─IndexScan_8 1999.00 cop table:t1, index:c2, range:[NULL,+inf], keep order:false + └─TableReader_12 0.00 root data:Selection_11 + └─Selection_11 0.00 cop eq(1, test.t2.c2) + └─TableScan_10 1985.00 cop table:t2, range:[-inf,+inf], keep order:false explain format="dot" select 1 in (select c2 from t2) from t1; dot contents @@ -142,23 +142,23 @@ node [style=filled, color=lightgrey] color=black label = "root" "Projection_6" -> "HashLeftJoin_7" -"HashLeftJoin_7" -> "IndexReader_11" -"HashLeftJoin_7" -> "TableReader_14" +"HashLeftJoin_7" -> "IndexReader_9" +"HashLeftJoin_7" -> "TableReader_12" } -subgraph cluster10{ +subgraph cluster8{ node [style=filled, color=lightgrey] color=black label = "cop" -"IndexScan_10" +"IndexScan_8" } -subgraph cluster13{ +subgraph cluster11{ node [style=filled, color=lightgrey] color=black label = "cop" -"Selection_13" -> "TableScan_12" +"Selection_11" -> "TableScan_10" } -"IndexReader_11" -> "IndexScan_10" -"TableReader_14" -> "Selection_13" +"IndexReader_9" -> "IndexScan_8" +"TableReader_12" -> "Selection_11" } explain select * from index_prune WHERE a = 1010010404050976781 AND b = 26467085526790 LIMIT 1; diff --git a/cmd/explaintest/r/generated_columns.result b/cmd/explaintest/r/generated_columns.result index 0add5d3921876..b8089dfb3a4f1 100644 --- a/cmd/explaintest/r/generated_columns.result +++ b/cmd/explaintest/r/generated_columns.result @@ -32,9 +32,9 @@ IndexReader_6 3323.33 root index:IndexScan_5 └─IndexScan_5 3323.33 cop table:sgc, index:a, b, range:[-inf,3), keep order:false, stats:pseudo EXPLAIN SELECT a, b from sgc where b < 3; id count task operator info -IndexLookUp_10 3323.33 root -├─IndexScan_8 3323.33 cop table:sgc, index:b, range:[-inf,3), keep order:false, stats:pseudo -└─TableScan_9 3323.33 cop table:sgc, keep order:false, stats:pseudo +IndexLookUp_7 3323.33 root +├─IndexScan_5 3323.33 cop table:sgc, index:b, range:[-inf,3), keep order:false, stats:pseudo +└─TableScan_6 3323.33 cop table:sgc, keep order:false, stats:pseudo EXPLAIN SELECT a, b from sgc where a < 3 and b < 3; id count task operator info IndexReader_11 1104.45 root index:Selection_10 diff --git a/cmd/explaintest/r/partition_pruning.result b/cmd/explaintest/r/partition_pruning.result index 9cda74b961214..247f7037ded6c 100644 --- a/cmd/explaintest/r/partition_pruning.result +++ b/cmd/explaintest/r/partition_pruning.result @@ -1040,490 +1040,490 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-02 23:59:59) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-02 23:59:59.000000) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03'; id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03'; id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03'; id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03'; id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03'; id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:01) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-02 23:59:58) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo DROP TABLE t1; # Test with DATE column NOT NULL CREATE TABLE t1 ( @@ -1543,490 +1543,490 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info -IndexReader_11 0.00 root index:Selection_10 -└─Selection_10 0.00 cop eq(test.t1.b, 2009-04-02 23:59:59) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 0.00 root index:Selection_7 +└─Selection_7 0.00 cop eq(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; id count task operator info -IndexReader_11 0.00 root index:Selection_10 -└─Selection_10 0.00 cop eq(test.t1.b, 2009-04-02 23:59:59.000000) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 0.00 root index:Selection_7 +└─Selection_7 0.00 cop eq(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:59.000000) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03'; id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03'; id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03'; id count task operator info -IndexReader_11 10.00 root index:Selection_10 -└─Selection_10 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 10.00 root index:Selection_7 +└─Selection_7 10.00 cop eq(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03'; id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03'; id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:00.000000) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop lt(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_9 9970.00 root +├─IndexReader_12 3323.33 root index:Selection_11 +│ └─Selection_11 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_10 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_15 3323.33 root index:Selection_14 │ └─Selection_14 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_21 3323.33 root index:Selection_20 -│ └─Selection_20 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_19 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_27 3323.33 root index:Selection_26 - └─Selection_26 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) - └─IndexScan_25 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_13 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_18 3323.33 root index:Selection_17 + └─Selection_17 3323.33 cop le(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_16 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info -IndexReader_11 0.00 root index:Selection_10 -└─Selection_10 0.00 cop eq(test.t1.b, 2009-04-03 00:00:01) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 0.00 root index:Selection_7 +└─Selection_7 0.00 cop eq(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop ge(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); id count task operator info Union_10 13333.33 root +├─IndexReader_13 3333.33 root index:Selection_12 +│ └─Selection_12 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_11 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_16 3333.33 root index:Selection_15 │ └─Selection_15 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_22 3333.33 root index:Selection_21 -│ └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_20 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_28 3333.33 root index:Selection_27 -│ └─Selection_27 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) -│ └─IndexScan_26 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_34 3333.33 root index:Selection_33 - └─Selection_33 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) - └─IndexScan_32 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_14 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_19 3333.33 root index:Selection_18 +│ └─Selection_18 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) +│ └─IndexScan_17 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_22 3333.33 root index:Selection_21 + └─Selection_21 3333.33 cop gt(test.t1.b, 2009-04-03 00:00:01) + └─IndexScan_20 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop lt(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_8 6646.67 root -├─IndexReader_14 3323.33 root index:Selection_13 -│ └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_20 3323.33 root index:Selection_19 - └─Selection_19 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) - └─IndexScan_18 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_11 3323.33 root index:Selection_10 +│ └─Selection_10 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_9 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_14 3323.33 root index:Selection_13 + └─Selection_13 3323.33 cop le(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_12 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info -IndexReader_11 0.00 root index:Selection_10 -└─Selection_10 0.00 cop eq(test.t1.b, 2009-04-02 23:59:58) - └─IndexScan_9 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +IndexReader_8 0.00 root index:Selection_7 +└─Selection_7 0.00 cop eq(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_6 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop ge(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); id count task operator info Union_11 16666.67 root +├─IndexReader_14 3333.33 root index:Selection_13 +│ └─Selection_13 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_12 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_17 3333.33 root index:Selection_16 │ └─Selection_16 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090401, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_15 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +├─IndexReader_20 3333.33 root index:Selection_19 +│ └─Selection_19 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) +│ └─IndexScan_18 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo ├─IndexReader_23 3333.33 root index:Selection_22 │ └─Selection_22 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090402, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_29 3333.33 root index:Selection_28 -│ └─Selection_28 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_27 10000.00 cop table:t1, partition:p20090403, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -├─IndexReader_35 3333.33 root index:Selection_34 -│ └─Selection_34 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) -│ └─IndexScan_33 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo -└─IndexReader_41 3333.33 root index:Selection_40 - └─Selection_40 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) - └─IndexScan_39 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +│ └─IndexScan_21 10000.00 cop table:t1, partition:p20090404, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo +└─IndexReader_26 3333.33 root index:Selection_25 + └─Selection_25 3333.33 cop gt(test.t1.b, 2009-04-02 23:59:58) + └─IndexScan_24 10000.00 cop table:t1, partition:p20090405, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo DROP TABLE t1; # Test with DATETIME column NULL CREATE TABLE t1 ( diff --git a/cmd/explaintest/r/select.result b/cmd/explaintest/r/select.result index 17d660065978d..f7441cf82887a 100644 --- a/cmd/explaintest/r/select.result +++ b/cmd/explaintest/r/select.result @@ -254,10 +254,10 @@ drop table if exists t; create table t (a int, b int, c int, key idx(a, b, c)); explain select count(a) from t; id count task operator info -StreamAgg_20 1.00 root funcs:count(col_0) -└─IndexReader_21 1.00 root index:StreamAgg_8 +StreamAgg_16 1.00 root funcs:count(col_0) +└─IndexReader_17 1.00 root index:StreamAgg_8 └─StreamAgg_8 1.00 cop funcs:count(test.t.a) - └─IndexScan_19 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexScan_15 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:false, stats:pseudo select count(a) from t; count(a) 0 @@ -265,30 +265,30 @@ insert t values(0,0,0); explain select distinct b from t group by a; id count task operator info HashAgg_7 8000.00 root group by:test.t.b, funcs:firstrow(test.t.b) -└─StreamAgg_22 8000.00 root group by:col_1, funcs:firstrow(col_0) - └─IndexReader_23 8000.00 root index:StreamAgg_11 +└─StreamAgg_19 8000.00 root group by:col_1, funcs:firstrow(col_0) + └─IndexReader_20 8000.00 root index:StreamAgg_11 └─StreamAgg_11 8000.00 cop group by:test.t.a, funcs:firstrow(test.t.b) - └─IndexScan_21 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo + └─IndexScan_18 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo select distinct b from t group by a; b 0 explain select count(b) from t group by a; id count task operator info -StreamAgg_19 8000.00 root group by:col_1, funcs:count(col_0) -└─IndexReader_20 8000.00 root index:StreamAgg_8 +StreamAgg_16 8000.00 root group by:col_1, funcs:count(col_0) +└─IndexReader_17 8000.00 root index:StreamAgg_8 └─StreamAgg_8 8000.00 cop group by:test.t.a, funcs:count(test.t.b) - └─IndexScan_18 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo + └─IndexScan_15 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo select count(b) from t group by a; count(b) 1 insert t values(1,1,1),(3,3,6),(3,2,5),(2,1,4),(1,1,3),(1,1,2); explain select count(a) from t where b>0 group by a, b; id count task operator info -StreamAgg_25 2666.67 root group by:col_1, col_2, funcs:count(col_0) -└─IndexReader_26 2666.67 root index:StreamAgg_9 +StreamAgg_20 2666.67 root group by:col_1, col_2, funcs:count(col_0) +└─IndexReader_21 2666.67 root index:StreamAgg_9 └─StreamAgg_9 2666.67 cop group by:test.t.a, test.t.b, funcs:count(test.t.a) - └─Selection_24 3333.33 cop gt(test.t.b, 0) - └─IndexScan_23 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo + └─Selection_19 3333.33 cop gt(test.t.b, 0) + └─IndexScan_18 10000.00 cop table:t, index:a, b, c, range:[NULL,+inf], keep order:true, stats:pseudo select count(a) from t where b>0 group by a, b; count(a) 3 diff --git a/cmd/explaintest/r/subquery.result b/cmd/explaintest/r/subquery.result index 6bc53a96a6f23..c3974d52757e3 100644 --- a/cmd/explaintest/r/subquery.result +++ b/cmd/explaintest/r/subquery.result @@ -16,9 +16,9 @@ analyze table t; explain select t.c in (select count(*) from t s use index(idx), t t1 where s.b = 1 and s.c = 1 and s.d = t.a and s.a = t1.a) from t; id count task operator info Projection_11 5.00 root 9_aux_0 -└─Apply_13 5.00 root CARTESIAN left outer semi join, inner:StreamAgg_22, other cond:eq(test.t.c, 7_col_0) - ├─TableReader_15 5.00 root data:TableScan_14 - │ └─TableScan_14 5.00 cop table:t, range:[-inf,+inf], keep order:false +└─Apply_13 5.00 root CARTESIAN left outer semi join, inner:StreamAgg_20, other cond:eq(test.t.c, 7_col_0) + ├─IndexReader_15 5.00 root index:IndexScan_14 + │ └─IndexScan_14 5.00 cop table:t, index:b, c, d, range:[NULL,+inf], keep order:false └─StreamAgg_20 1.00 root funcs:count(1) └─IndexJoin_23 0.50 root inner join, inner:TableReader_22, outer key:test.s.a, inner key:test.t1.a ├─IndexReader_27 1.00 root index:IndexScan_26 diff --git a/cmd/explaintest/r/topn_push_down.result b/cmd/explaintest/r/topn_push_down.result index 4d40a3b3b8caf..9deb403ecceca 100644 --- a/cmd/explaintest/r/topn_push_down.result +++ b/cmd/explaintest/r/topn_push_down.result @@ -223,8 +223,8 @@ explain select /*+ TIDB_INLJ(t2) */ * from t t1 join t t2 on t1.a = t2.a limit 5 id count task operator info Limit_11 5.00 root offset:0, count:5 └─IndexJoin_15 5.00 root inner join, inner:IndexReader_14, outer key:test.t1.a, inner key:test.t2.a - ├─TableReader_17 4.00 root data:TableScan_16 - │ └─TableScan_16 4.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo + ├─IndexReader_17 4.00 root index:IndexScan_16 + │ └─IndexScan_16 4.00 cop table:t1, index:a, range:[NULL,+inf], keep order:false, stats:pseudo └─IndexReader_14 10.00 root index:IndexScan_13 └─IndexScan_13 10.00 cop table:t2, index:a, range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo explain select /*+ TIDB_INLJ(t2) */ * from t t1 left join t t2 on t1.a = t2.a where t2.a is null limit 5; @@ -232,8 +232,8 @@ id count task operator info Limit_12 5.00 root offset:0, count:5 └─Selection_13 5.00 root isnull(test.t2.a) └─IndexJoin_17 5.00 root left outer join, inner:IndexReader_16, outer key:test.t1.a, inner key:test.t2.a - ├─TableReader_19 4.00 root data:TableScan_18 - │ └─TableScan_18 4.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo + ├─IndexReader_19 4.00 root index:IndexScan_18 + │ └─IndexScan_18 4.00 cop table:t1, index:a, range:[NULL,+inf], keep order:false, stats:pseudo └─IndexReader_16 10.00 root index:IndexScan_15 └─IndexScan_15 10.00 cop table:t2, index:a, range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo explain select /*+ TIDB_SMJ(t1, t2) */ * from t t1 join t t2 on t1.a = t2.a limit 5; @@ -256,17 +256,17 @@ Limit_12 5.00 root offset:0, count:5 explain select /*+ TIDB_HJ(t1, t2) */ * from t t1 join t t2 on t1.a = t2.a limit 5; id count task operator info Limit_11 5.00 root offset:0, count:5 -└─HashLeftJoin_19 5.00 root inner join, inner:TableReader_24, equal:[eq(test.t1.a, test.t2.a)] - ├─TableReader_22 4.00 root data:TableScan_21 - │ └─TableScan_21 4.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo - └─TableReader_24 10000.00 root data:TableScan_23 - └─TableScan_23 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo +└─HashLeftJoin_19 5.00 root inner join, inner:IndexReader_24, equal:[eq(test.t1.a, test.t2.a)] + ├─IndexReader_22 4.00 root index:IndexScan_21 + │ └─IndexScan_21 4.00 cop table:t1, index:a, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexReader_24 10000.00 root index:IndexScan_23 + └─IndexScan_23 10000.00 cop table:t2, index:a, range:[NULL,+inf], keep order:false, stats:pseudo explain select /*+ TIDB_HJ(t1, t2) */ * from t t1 left join t t2 on t1.a = t2.a where t2.a is null limit 5; id count task operator info Limit_12 5.00 root offset:0, count:5 └─Selection_13 5.00 root isnull(test.t2.a) - └─HashLeftJoin_18 5.00 root left outer join, inner:TableReader_22, equal:[eq(test.t1.a, test.t2.a)] - ├─TableReader_20 4.00 root data:TableScan_19 - │ └─TableScan_19 4.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo - └─TableReader_22 10000.00 root data:TableScan_21 - └─TableScan_21 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo + └─HashLeftJoin_18 5.00 root left outer join, inner:IndexReader_22, equal:[eq(test.t1.a, test.t2.a)] + ├─IndexReader_20 4.00 root index:IndexScan_19 + │ └─IndexScan_19 4.00 cop table:t1, index:a, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexReader_22 10000.00 root index:IndexScan_21 + └─IndexScan_21 10000.00 cop table:t2, index:a, range:[NULL,+inf], keep order:false, stats:pseudo diff --git a/cmd/explaintest/r/window_function.result b/cmd/explaintest/r/window_function.result index a42e173de48ba..6096ce1ab4023 100644 --- a/cmd/explaintest/r/window_function.result +++ b/cmd/explaintest/r/window_function.result @@ -6,8 +6,8 @@ explain select sum(a) over() from t; id count task operator info Projection_7 10000.00 root sum(a) over() └─Window_8 10000.00 root sum(cast(test.t.a)) over() - └─IndexReader_12 10000.00 root index:IndexScan_11 - └─IndexScan_11 10000.00 cop table:t, index:a, range:[NULL,+inf], keep order:false, stats:pseudo + └─IndexReader_10 10000.00 root index:IndexScan_9 + └─IndexScan_9 10000.00 cop table:t, index:a, range:[NULL,+inf], keep order:false, stats:pseudo explain select sum(a) over(partition by a) from t; id count task operator info Projection_7 10000.00 root sum(a) over(partition by a) diff --git a/planner/core/cbo_test.go b/planner/core/cbo_test.go index 1ece0c570cf4d..8dab6a8829639 100644 --- a/planner/core/cbo_test.go +++ b/planner/core/cbo_test.go @@ -286,7 +286,7 @@ func (s *testAnalyzeSuite) TestIndexRead(c *C) { }{ { sql: "select count(*) from t group by e", - best: "IndexReader(Index(t.e)[[NULL,+inf]])->HashAgg", + best: "IndexReader(Index(t.e)[[NULL,+inf]]->StreamAgg)->StreamAgg", }, { sql: "select count(*) from t where e <= 10 group by e", @@ -298,7 +298,7 @@ func (s *testAnalyzeSuite) TestIndexRead(c *C) { }, { sql: "select count(*) from t where c > '1' group by b", - best: "IndexReader(Index(t.b_c)[[NULL,+inf]]->Sel([gt(test.t.c, 1)]))->HashAgg", + best: "IndexReader(Index(t.b_c)[[NULL,+inf]]->Sel([gt(test.t.c, 1)])->StreamAgg)->StreamAgg", }, { sql: "select count(*) from t where e = 1 group by b", @@ -689,22 +689,22 @@ func (s *testAnalyzeSuite) TestCorrelatedEstimation(c *C) { tk.MustQuery("explain select t.c in (select count(*) from t s , t t1 where s.a = t.a and s.a = t1.a) from t;"). Check(testkit.Rows( "Projection_11 10.00 root 9_aux_0", - "└─Apply_13 10.00 root CARTESIAN left outer semi join, inner:StreamAgg_22, other cond:eq(test.t.c, 7_col_0)", + "└─Apply_13 10.00 root CARTESIAN left outer semi join, inner:StreamAgg_20, other cond:eq(test.t.c, 7_col_0)", " ├─TableReader_15 10.00 root data:TableScan_14", " │ └─TableScan_14 10.00 cop table:t, range:[-inf,+inf], keep order:false", - " └─StreamAgg_22 1.00 root funcs:count(1)", - " └─HashLeftJoin_23 1.00 root inner join, inner:TableReader_33, equal:[eq(test.s.a, test.t1.a)]", - " ├─TableReader_27 1.00 root data:Selection_26", - " │ └─Selection_26 1.00 cop eq(test.s.a, test.t.a), not(isnull(test.s.a))", - " │ └─TableScan_25 10.00 cop table:s, range:[-inf,+inf], keep order:false", - " └─TableReader_33 1.00 root data:Selection_32", - " └─Selection_32 1.00 cop eq(test.t1.a, test.t.a), not(isnull(test.t1.a))", - " └─TableScan_31 10.00 cop table:t1, range:[-inf,+inf], keep order:false", + " └─StreamAgg_20 1.00 root funcs:count(1)", + " └─HashLeftJoin_21 1.00 root inner join, inner:TableReader_28, equal:[eq(test.s.a, test.t1.a)]", + " ├─TableReader_25 1.00 root data:Selection_24", + " │ └─Selection_24 1.00 cop eq(test.s.a, test.t.a), not(isnull(test.s.a))", + " │ └─TableScan_23 10.00 cop table:s, range:[-inf,+inf], keep order:false", + " └─TableReader_28 1.00 root data:Selection_27", + " └─Selection_27 1.00 cop eq(test.t1.a, test.t.a), not(isnull(test.t1.a))", + " └─TableScan_26 10.00 cop table:t1, range:[-inf,+inf], keep order:false", )) tk.MustQuery("explain select (select concat(t1.a, \",\", t1.b) from t t1 where t1.a=t.a and t1.c=t.c) from t"). Check(testkit.Rows( "Projection_8 10.00 root concat(t1.a, \",\", t1.b)", - "└─Apply_10 10.00 root CARTESIAN left outer join, inner:MaxOneRow_15", + "└─Apply_10 10.00 root CARTESIAN left outer join, inner:MaxOneRow_13", " ├─TableReader_12 10.00 root data:TableScan_11", " │ └─TableScan_11 10.00 cop table:t, range:[-inf,+inf], keep order:false", " └─MaxOneRow_13 1.00 root ", @@ -915,13 +915,13 @@ func (s *testAnalyzeSuite) TestIssue9562(c *C) { tk.MustExec("create table t(a int, b int, index idx_ab(a, b))") tk.MustQuery("explain select * from t t1 join t t2 where t1.b = t2.b and t2.b is null").Check(testkit.Rows( "Projection_7 0.00 root test.t1.a, test.t1.b, test.t2.a, test.t2.b", - "└─HashRightJoin_9 0.00 root inner join, inner:IndexReader_15, equal:[eq(test.t2.b, test.t1.b)]", - " ├─IndexReader_15 0.00 root index:Selection_14", - " │ └─Selection_14 0.00 cop isnull(test.t2.b), not(isnull(test.t2.b))", - " │ └─IndexScan_13 10000.00 cop table:t2, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo", - " └─IndexReader_21 9990.00 root index:Selection_20", - " └─Selection_20 9990.00 cop not(isnull(test.t1.b))", - " └─IndexScan_19 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo", + "└─HashRightJoin_9 0.00 root inner join, inner:IndexReader_12, equal:[eq(test.t2.b, test.t1.b)]", + " ├─IndexReader_12 0.00 root index:Selection_11", + " │ └─Selection_11 0.00 cop isnull(test.t2.b), not(isnull(test.t2.b))", + " │ └─IndexScan_10 10000.00 cop table:t2, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo", + " └─IndexReader_15 9990.00 root index:Selection_14", + " └─Selection_14 9990.00 cop not(isnull(test.t1.b))", + " └─IndexScan_13 10000.00 cop table:t1, index:a, b, range:[NULL,+inf], keep order:false, stats:pseudo", )) } diff --git a/planner/core/find_best_task.go b/planner/core/find_best_task.go index a025c809634ae..edbc91455500e 100644 --- a/planner/core/find_best_task.go +++ b/planner/core/find_best_task.go @@ -211,6 +211,18 @@ type candidatePath struct { isMatchProp bool } +// getScanType converts the scan type to int, the higher the better. +// DoubleScan -> 0, TableScan -> 1, IndexScan -> 2. +func getScanTypeScore(p *candidatePath) int { + if !p.isSingleScan { + return 0; + } + if p.path.isTablePath { + return 1; + } + return 2; +} + // compareColumnSet will compares the two set. The last return value is used to indicate // if they are comparable, it is false when both two sets have columns that do not occur in the other. // When the second return value is true, the value of first: @@ -241,10 +253,20 @@ func compareBool(l, r bool) int { return 1 } +func compareInt(l, r int) int { + if l == r { + return 0 + } + if l < r { + return -1 + } + return 1 +} + // compareCandidates is the core of skyline pruning. It compares the two candidate paths on three dimensions: // (1): the set of columns that occurred in the access condition, // (2): whether or not it matches the physical property -// (3): does it require a double scan. +// (3): whether the candidate is a IndexScan or TableScan or DoubleScan. (IndexScan > TableScan > DoubleScan) // If `x` is not worse than `y` at all factors, // and there exists one factor that `x` is better than `y`, then `x` is better than `y`. func compareCandidates(lhs, rhs *candidatePath) int { @@ -252,7 +274,7 @@ func compareCandidates(lhs, rhs *candidatePath) int { if !comparable { return 0 } - scanResult := compareBool(lhs.isSingleScan, rhs.isSingleScan) + scanResult := compareInt(getScanTypeScore(lhs), getScanTypeScore(rhs)) matchResult := compareBool(lhs.isMatchProp, rhs.isMatchProp) sum := setsResult + scanResult + matchResult if setsResult >= 0 && scanResult >= 0 && matchResult >= 0 && sum > 0 { @@ -305,7 +327,7 @@ func (ds *DataSource) skylinePruning(prop *property.PhysicalProperty) []*candida var currentCandidate *candidatePath if path.isTablePath { currentCandidate = ds.getTableCandidate(path, prop) - } else if len(path.accessConds) > 0 || !prop.IsEmpty() || path.forced || isCoveringIndex(ds.schema.Columns, path.fullIdxCols, path.fullIdxColLens, ds.tableInfo.PKIsHandle) { + } else if len(path.accessConds) > 0 || !prop.IsEmpty() || path.forced || isCoveringIndex(ds.schema.Columns, path.index.Columns, ds.tableInfo.PKIsHandle) { // We will use index to generate physical plan if any of the following conditions is satisfied: // 1. This path's access cond is not nil. // 2. We have a non-empty prop to match. diff --git a/planner/core/logical_plan_test.go b/planner/core/logical_plan_test.go index dc20ba333fd7b..e1dfc14302692 100644 --- a/planner/core/logical_plan_test.go +++ b/planner/core/logical_plan_test.go @@ -2237,7 +2237,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select a, avg(a+1) over(partition by (a+1)) from t", - result: "IndexReader(Index(t.f)[[NULL,+inf]])->Projection->Sort->Window(avg(cast(2_proj_window_3)) over(partition by 2_proj_window_2))->Projection", + result: "IndexReader(Index(t.c_d_e)[[NULL,+inf]])->Projection->Sort->Window(avg(cast(2_proj_window_3)) over(partition by 2_proj_window_2))->Projection", }, { sql: "select a, avg(a) over(order by a asc, b desc) from t order by a asc, b desc", @@ -2257,7 +2257,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select sum(avg(a)) over() from t", - result: "IndexReader(Index(t.f)[[NULL,+inf]]->StreamAgg)->StreamAgg->Window(sum(sel_agg_2) over())->Projection", + result: "IndexReader(Index(t.c_d_e)[[NULL,+inf]]->StreamAgg)->StreamAgg->Window(sum(sel_agg_2) over())->Projection", }, { sql: "select b from t order by(sum(a) over())", @@ -2273,7 +2273,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select a from t having (select sum(a) over() as w from t tt where a > t.a)", - result: "Apply{IndexReader(Index(t.f)[[NULL,+inf]])->IndexReader(Index(t.f)[[NULL,+inf]]->Sel([gt(test.tt.a, test.t.a)]))->Window(sum(cast(test.tt.a)) over())->MaxOneRow->Sel([w])}->Projection", + result: "Apply{IndexReader(Index(t.c_d_e)[[NULL,+inf]])->IndexReader(Index(t.c_d_e)[[NULL,+inf]]->Sel([gt(test.tt.a, test.t.a)]))->Window(sum(cast(test.tt.a)) over())->MaxOneRow->Sel([w])}->Projection", }, { sql: "select avg(a) over() as w from t having w > 1", @@ -2305,7 +2305,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select sum(a) over w from t window w as (rows between 1 preceding AND 1 following)", - result: "IndexReader(Index(t.f)[[NULL,+inf]])->Window(sum(cast(test.t.a)) over(rows between 1 preceding and 1 following))->Projection", + result: "IndexReader(Index(t.c_d_e)[[NULL,+inf]])->Window(sum(cast(test.t.a)) over(rows between 1 preceding and 1 following))->Projection", }, { sql: "select sum(a) over(w order by b) from t window w as (order by a)", @@ -2373,7 +2373,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select row_number() over(rows between 1 preceding and 1 following) from t", - result: "IndexReader(Index(t.f)[[NULL,+inf]])->Window(row_number() over())->Projection", + result: "IndexReader(Index(t.c_d_e)[[NULL,+inf]])->Window(row_number() over())->Projection", }, { sql: "select avg(b), max(avg(b)) over(rows between 1 preceding and 1 following) max from t group by c", @@ -2397,7 +2397,7 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { }, { sql: "select ntile(null) over() from t", - result: "IndexReader(Index(t.f)[[NULL,+inf]])->Window(ntile() over())->Projection", + result: "IndexReader(Index(t.c_d_e)[[NULL,+inf]])->Window(ntile() over())->Projection", }, { sql: "select avg(a) over w from t window w as(partition by b)", @@ -2574,7 +2574,7 @@ func (s *testPlanSuite) TestSkylinePruning(c *C) { }, { sql: "select count(1) from t", - result: "PRIMARY_KEY,c_d_e,f,g,f_g,c_d_e_str,e_d_c_str_prefix", + result: "c_d_e,f,g,f_g,c_d_e_str,e_d_c_str_prefix", }, } ctx := context.TODO() diff --git a/planner/core/physical_plan_test.go b/planner/core/physical_plan_test.go index 206e697d705cc..3916ce52b5abb 100644 --- a/planner/core/physical_plan_test.go +++ b/planner/core/physical_plan_test.go @@ -208,7 +208,7 @@ func (s *testPlanSuite) TestDAGPlanBuilderSimpleCase(c *C) { }, { sql: "select lead(a, 1) over (partition by null) as c from t", - best: "IndexReader(Index(t.f)[[NULL,+inf]])->Window(lead(test.t.a, 1) over())->Projection", + best: "IndexReader(Index(t.c_d_e)[[NULL,+inf]])->Window(lead(test.t.a, 1) over())->Projection", }, } for i, tt := range tests { @@ -300,7 +300,7 @@ func (s *testPlanSuite) TestDAGPlanBuilderJoin(c *C) { }, { sql: "select t.c in (select b from t s where s.a = t.a) from t", - best: "LeftHashJoin{IndexReader(Index(t.c_d_e)[[NULL,+inf]])->TableReader(Table(t))}(test.t.a,test.s.a)(test.t.c,test.s.b)->Projection", + best: "MergeLeftOuterSemiJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.a,test.s.a)->Projection", }, // Test Single Merge Join. // Merge Join now enforce a sort. @@ -371,7 +371,7 @@ func (s *testPlanSuite) TestDAGPlanBuilderJoin(c *C) { // Test Index Join + SingleRead. { sql: "select /*+ TIDB_INLJ(t2) */ t1.a , t2.a from t t1, t t2 where t1.a = t2.c", - best: "IndexJoin{TableReader(Table(t))->IndexReader(Index(t.c_d_e)[[NULL,+inf]])}(test.t1.a,test.t2.c)->Projection", + best: "IndexJoin{IndexReader(Index(t.c_d_e)[[NULL,+inf]])->IndexReader(Index(t.c_d_e)[[NULL,+inf]])}(test.t1.a,test.t2.c)->Projection", }, // Test Index Join + Order by. { @@ -386,7 +386,7 @@ func (s *testPlanSuite) TestDAGPlanBuilderJoin(c *C) { // Test Index Join + TableScan + Rotate. { sql: "select /*+ TIDB_INLJ(t1) */ t1.a , t2.a from t t1, t t2 where t1.a = t2.c", - best: "IndexJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t2.c,test.t1.a)->Projection", + best: "IndexJoin{TableReader(Table(t))->IndexReader(Index(t.c_d_e)[[NULL,+inf]])}(test.t2.c,test.t1.a)->Projection", }, // Test Index Join + OuterJoin + TableScan. { @@ -415,7 +415,7 @@ func (s *testPlanSuite) TestDAGPlanBuilderJoin(c *C) { // Test Semi Join hint fail. { sql: "select /*+ TIDB_INLJ(t1) */ * from t t1 where t1.a in (select a from t t2)", - best: "IndexJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t2.a,test.t1.a)->Projection", + best: "IndexJoin{TableReader(Table(t))->IndexReader(Index(t.c_d_e)[[NULL,+inf]])}(test.t2.a,test.t1.a)->Projection", }, { sql: "select /*+ TIDB_INLJ(t2) */ * from t t1 join t t2 where t1.c=t2.c and t1.f=t2.f", @@ -485,11 +485,11 @@ func (s *testPlanSuite) TestDAGPlanBuilderSubquery(c *C) { // Test join key with cast. { sql: "select * from t where exists (select s.a from t s having sum(s.a) = t.a )", - best: "LeftHashJoin{TableReader(Table(t))->Projection->IndexReader(Index(t.f)[[NULL,+inf]]->StreamAgg)->StreamAgg}(cast(test.t.a),sel_agg_1)->Projection", + best: "LeftHashJoin{TableReader(Table(t))->Projection->IndexReader(Index(t.c_d_e)[[NULL,+inf]]->StreamAgg)->StreamAgg}(cast(test.t.a),sel_agg_1)->Projection", }, { sql: "select * from t where exists (select s.a from t s having sum(s.a) = t.a ) order by t.a", - best: "LeftHashJoin{TableReader(Table(t))->Projection->IndexReader(Index(t.f)[[NULL,+inf]]->StreamAgg)->StreamAgg}(cast(test.t.a),sel_agg_1)->Projection->Sort", + best: "LeftHashJoin{TableReader(Table(t))->Projection->IndexReader(Index(t.c_d_e)[[NULL,+inf]]->StreamAgg)->StreamAgg}(cast(test.t.a),sel_agg_1)->Projection->Sort", }, // FIXME: Report error by resolver. //{ @@ -508,20 +508,20 @@ func (s *testPlanSuite) TestDAGPlanBuilderSubquery(c *C) { // Test Semi Join + Order by. { sql: "select * from t where a in (select a from t) order by b", - best: "LeftHashJoin{TableReader(Table(t))->IndexReader(Index(t.f)[[NULL,+inf]])}(test.t.a,test.t.a)->Projection->Sort", + best: "MergeInnerJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t.a,test.t.a)->Projection->Sort", }, // Test Apply. { sql: "select t.c in (select count(*) from t s , t t1 where s.a = t.a and s.a = t1.a) from t", - best: "Apply{TableReader(Table(t))->IndexJoin{TableReader(Table(t))->TableReader(Table(t)->Sel([eq(test.t1.a, test.t.a)]))}(test.s.a,test.t1.a)->StreamAgg}->Projection", + best: "Apply{IndexReader(Index(t.c_d_e)[[NULL,+inf]])->IndexJoin{TableReader(Table(t))->TableReader(Table(t)->Sel([eq(test.t1.a, test.t.a)]))}(test.s.a,test.t1.a)->StreamAgg}->Projection", }, { sql: "select (select count(*) from t s , t t1 where s.a = t.a and s.a = t1.a) from t", - best: "LeftHashJoin{TableReader(Table(t))->MergeInnerJoin{TableReader(Table(t))->TableReader(Table(t))}(test.s.a,test.t1.a)->StreamAgg}(test.t.a,test.s.a)->Projection->Projection", + best: "LeftHashJoin{IndexReader(Index(t.c_d_e)[[NULL,+inf]])->MergeInnerJoin{TableReader(Table(t))->TableReader(Table(t))}(test.s.a,test.t1.a)->StreamAgg}(test.t.a,test.s.a)->Projection->Projection", }, { sql: "select (select count(*) from t s , t t1 where s.a = t.a and s.a = t1.a) from t order by t.a", - best: "LeftHashJoin{TableReader(Table(t))->MergeInnerJoin{TableReader(Table(t))->TableReader(Table(t))}(test.s.a,test.t1.a)->StreamAgg}(test.t.a,test.s.a)->Projection->Sort->Projection", + best: "LeftHashJoin{IndexReader(Index(t.c_d_e)[[NULL,+inf]])->MergeInnerJoin{TableReader(Table(t))->TableReader(Table(t))}(test.s.a,test.t1.a)->StreamAgg}(test.t.a,test.s.a)->Projection->Sort->Projection", }, } for _, tt := range tests { @@ -1054,7 +1054,7 @@ func (s *testPlanSuite) TestRefine(c *C) { }, { sql: "select a from t where not a", - best: "IndexReader(Index(t.f)[[NULL,+inf]]->Sel([not(test.t.a)]))", + best: "IndexReader(Index(t.c_d_e)[[NULL,+inf]]->Sel([not(test.t.a)]))", }, { sql: "select a from t where c in (1)", @@ -1243,12 +1243,12 @@ func (s *testPlanSuite) TestAggEliminater(c *C) { // If max/min contains scalar function, we can still do transformation. { sql: "select max(a+1) from t;", - best: "IndexReader(Index(t.f)[[NULL,+inf]]->Sel([not(isnull(plus(test.t.a, 1)))])->TopN([plus(test.t.a, 1) true],0,1))->Projection->TopN([col_1 true],0,1)->Projection->Projection->StreamAgg", + best: "IndexReader(Index(t.c_d_e)[[NULL,+inf]]->Sel([not(isnull(plus(test.t.a, 1)))])->TopN([plus(test.t.a, 1) true],0,1))->Projection->TopN([col_1 true],0,1)->Projection->Projection->StreamAgg", }, // Do nothing to max+min. { sql: "select max(a), min(a) from t;", - best: "IndexReader(Index(t.f)[[NULL,+inf]]->StreamAgg)->StreamAgg", + best: "IndexReader(Index(t.c_d_e)[[NULL,+inf]]->StreamAgg)->StreamAgg", }, // Do nothing to max with groupby. { @@ -1357,7 +1357,7 @@ func (s *testPlanSuite) TestIndexJoinUnionScan(c *C) { // Test Index Join + UnionScan + IndexScan. { sql: "select /*+ TIDB_INLJ(t1, t2) */ t1.a , t2.c from t t1, t t2 where t1.a = t2.c", - best: "IndexJoin{TableReader(Table(t))->UnionScan([])->IndexReader(Index(t.c_d_e)[[NULL,+inf]])->UnionScan([])}(test.t1.a,test.t2.c)->Projection", + best: "IndexJoin{IndexReader(Index(t.c_d_e)[[NULL,+inf]])->UnionScan([])->IndexReader(Index(t.c_d_e)[[NULL,+inf]])->UnionScan([])}(test.t1.a,test.t2.c)->Projection", is: s.is, }, // Index Join + Union Scan + Union All is not supported now. @@ -1538,12 +1538,12 @@ func (s *testPlanSuite) TestIndexJoinHint(c *C) { }, { sql: "select /*+ TIDB_INLJ(t1) */ t1.b, t2.a from t t1, t t2 where t1.b = t2.a;", - best: "LeftHashJoin{TableReader(Table(t))->TableReader(Table(t))}(test.t1.b,test.t2.a)", + best: "LeftHashJoin{TableReader(Table(t))->IndexReader(Index(t.c_d_e)[[NULL,+inf]])}(test.t1.b,test.t2.a)", warning: "[planner:1815]Optimizer Hint /*+ TIDB_INLJ(t1) */ is inapplicable", }, { sql: "select /*+ TIDB_INLJ(t2) */ t1.b, t2.a from t2 t1, t2 t2 where t1.b=t2.b and t2.c=-1;", - best: "IndexJoin{IndexReader(Index(t2.b)[[NULL,+inf]])->TableReader(Table(t2)->Sel([eq(test.t2.c, -1)]))}(test.t2.b,test.t1.b)->Projection", + best: "IndexJoin{IndexReader(Index(t2.b)[[NULL,+inf]])->IndexReader(Index(t2.b_c)[[NULL,+inf]]->Sel([eq(test.t2.c, -1)]))}(test.t2.b,test.t1.b)->Projection", warning: "[planner:1815]Optimizer Hint /*+ TIDB_INLJ(t2) */ is inapplicable", }, } From 28e0187fa30bdcb90fe50eadd56a6ff31dc38594 Mon Sep 17 00:00:00 2001 From: francis0407 Date: Tue, 10 Sep 2019 11:52:11 +0800 Subject: [PATCH 3/7] fix fmt --- planner/core/find_best_task.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/planner/core/find_best_task.go b/planner/core/find_best_task.go index edbc91455500e..2be6c5982ed22 100644 --- a/planner/core/find_best_task.go +++ b/planner/core/find_best_task.go @@ -215,12 +215,12 @@ type candidatePath struct { // DoubleScan -> 0, TableScan -> 1, IndexScan -> 2. func getScanTypeScore(p *candidatePath) int { if !p.isSingleScan { - return 0; + return 0 } if p.path.isTablePath { - return 1; + return 1 } - return 2; + return 2 } // compareColumnSet will compares the two set. The last return value is used to indicate @@ -266,7 +266,7 @@ func compareInt(l, r int) int { // compareCandidates is the core of skyline pruning. It compares the two candidate paths on three dimensions: // (1): the set of columns that occurred in the access condition, // (2): whether or not it matches the physical property -// (3): whether the candidate is a IndexScan or TableScan or DoubleScan. (IndexScan > TableScan > DoubleScan) +// (3): whether the candidate is a IndexScan or TableScan or DoubleScan. (IndexScan > TableScan > DoubleScan) // If `x` is not worse than `y` at all factors, // and there exists one factor that `x` is better than `y`, then `x` is better than `y`. func compareCandidates(lhs, rhs *candidatePath) int { From 89363c0e1b41e7aa11c260e4640ecf5ad0488192 Mon Sep 17 00:00:00 2001 From: francis0407 Date: Tue, 10 Sep 2019 11:58:13 +0800 Subject: [PATCH 4/7] fix ranger tests --- util/ranger/ranger_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/util/ranger/ranger_test.go b/util/ranger/ranger_test.go index 2f4d465586b65..c426dcdefa32c 100644 --- a/util/ranger/ranger_test.go +++ b/util/ranger/ranger_test.go @@ -1106,11 +1106,11 @@ func (s *testRangerSuite) TestCompIndexInExprCorrCol(c *C) { " ├─TableReader_15 2.00 root data:TableScan_14", " │ └─TableScan_14 2.00 cop table:t, range:[-inf,+inf], keep order:false", " └─StreamAgg_20 1.00 root funcs:count(1)", - " └─IndexMergeJoin_42 2.00 root inner join, inner:TableReader_40, outer key:test.s.a, inner key:test.t1.a", - " ├─IndexReader_31 2.00 root index:IndexScan_30", - " │ └─IndexScan_30 2.00 cop table:s, index:b, c, d, range: decided by [eq(test.s.b, 1) in(test.s.c, 1, 2) eq(test.s.d, test.t.a)], keep order:false", - " └─TableReader_40 1.00 root data:TableScan_39", - " └─TableScan_39 1.00 cop table:t1, range: decided by [test.s.a], keep order:true", + " └─IndexJoin_32 2.00 root inner join, inner:TableReader_31, outer key:test.s.a, inner key:test.t1.a", + " ├─IndexReader_27 2.00 root index:IndexScan_26", + " │ └─IndexScan_26 2.00 cop table:s, index:b, c, d, range: decided by [eq(test.s.b, 1) in(test.s.c, 1, 2) eq(test.s.d, test.t.a)], keep order:false", + " └─TableReader_31 1.00 root data:TableScan_30", + " └─TableScan_30 1.00 cop table:t1, range: decided by [test.s.a], keep order:false", )) testKit.MustQuery("select t.e in (select count(*) from t s use index(idx), t t1 where s.b = 1 and s.c in (1, 2) and s.d = t.a and s.a = t1.a) from t").Check(testkit.Rows( "1", From b883f1d2d90b365c5d692b0e6b96b20da3d4e36f Mon Sep 17 00:00:00 2001 From: francis0407 Date: Tue, 10 Sep 2019 12:09:54 +0800 Subject: [PATCH 5/7] fix update_tests --- statistics/handle/update_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/statistics/handle/update_test.go b/statistics/handle/update_test.go index 83705e8bf6908..fc91d29a84cee 100644 --- a/statistics/handle/update_test.go +++ b/statistics/handle/update_test.go @@ -1529,24 +1529,24 @@ func (s *testStatsSuite) TestFeedbackRanges(c *C) { }{ { sql: "select * from t where a <= 50 or (a > 130 and a < 140)", - hist: "column:1 ndv:30 totColSize:0\n" + - "num: 8 lower_bound: -128 upper_bound: 7 repeats: 0\n" + - "num: 8 lower_bound: 8 upper_bound: 15 repeats: 0\n" + - "num: 14 lower_bound: 16 upper_bound: 50 repeats: 0", + hist: "column:1 ndv:20 totColSize:0\n" + + "num: 8 lower_bound: 0 upper_bound: 7 repeats: 1\n" + + "num: 8 lower_bound: 8 upper_bound: 15 repeats: 1\n" + + "num: 4 lower_bound: 16 upper_bound: 19 repeats: 1", colID: 1, }, { sql: "select * from t where a >= 10", - hist: "column:1 ndv:30 totColSize:0\n" + - "num: 8 lower_bound: -128 upper_bound: 7 repeats: 0\n" + - "num: 8 lower_bound: 8 upper_bound: 15 repeats: 0\n" + - "num: 14 lower_bound: 16 upper_bound: 127 repeats: 0", + hist: "column:1 ndv:20 totColSize:0\n" + + "num: 8 lower_bound: 0 upper_bound: 7 repeats: 1\n" + + "num: 8 lower_bound: 8 upper_bound: 15 repeats: 1\n" + + "num: 4 lower_bound: 16 upper_bound: 19 repeats: 1", colID: 1, }, { sql: "select * from t use index(idx) where a = 1 and (b <= 50 or (b > 130 and b < 140))", hist: "column:2 ndv:20 totColSize:20\n" + - "num: 7 lower_bound: -128 upper_bound: 6 repeats: 0\n" + + "num: 9 lower_bound: -128 upper_bound: 6 repeats: 0\n" + "num: 7 lower_bound: 7 upper_bound: 13 repeats: 1\n" + "num: 6 lower_bound: 14 upper_bound: 19 repeats: 1", colID: 2, From 91243017cdec14da8510c134230f90e7f60f45fd Mon Sep 17 00:00:00 2001 From: francis0407 Date: Tue, 10 Sep 2019 12:27:03 +0800 Subject: [PATCH 6/7] fix join_test, union_scan_test --- executor/join_test.go | 4 ++-- executor/union_scan_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/executor/join_test.go b/executor/join_test.go index df027e780ab5d..550898be5e2dd 100644 --- a/executor/join_test.go +++ b/executor/join_test.go @@ -832,8 +832,8 @@ func (s *testSuite2) TestIndexLookupJoin(c *C) { tk.MustExec("CREATE INDEX idx_s_a ON s(`a`)") tk.MustExec("INSERT INTO s VALUES (-277544960, 'fpnndsjo') , (2, 'kfpnndsjof') , (2, 'vtdiockfpn'), (-277544960, 'fpnndsjo') , (2, 'kfpnndsjof') , (6, 'ckfp')") tk.MustQuery("select /*+ TIDB_INLJ(t, s) */ t.a from t join s on t.a = s.a").Check(testkit.Rows("-277544960", "-277544960")) - tk.MustQuery("select /*+ TIDB_INLJ(t, s) */ t.a from t left join s on t.a = s.a").Check(testkit.Rows("148307968", "-1327693824", "-277544960", "-277544960")) - tk.MustQuery("select /*+ TIDB_INLJ(t, s) */ t.a from t right join s on t.a = s.a").Check(testkit.Rows("-277544960", "", "", "-277544960", "", "")) + tk.MustQuery("select /*+ TIDB_INLJ(t, s) */ t.a from t left join s on t.a = s.a"). Check(testkit.Rows("-1327693824", "-277544960", "-277544960", "148307968")) + tk.MustQuery("select /*+ TIDB_INLJ(t, s) */ t.a from t right join s on t.a = s.a").Check(testkit.Rows("-277544960", "-277544960","", "", "", "")) tk.MustExec("DROP TABLE IF EXISTS t;") tk.MustExec("CREATE TABLE t(a BIGINT PRIMARY KEY, b BIGINT);") tk.MustExec("INSERT INTO t VALUES(1, 2);") diff --git a/executor/union_scan_test.go b/executor/union_scan_test.go index 7fc90083cf144..bdb56413a85c4 100644 --- a/executor/union_scan_test.go +++ b/executor/union_scan_test.go @@ -28,7 +28,7 @@ func (s *testSuite4) TestDirtyTransaction(c *C) { tk.MustQuery("select * from t").Check(testkit.Rows("2 3", "4 8", "6 8")) tk.MustExec("insert t values (1, 5), (3, 4), (7, 6)") tk.MustQuery("select * from information_schema.columns") - tk.MustQuery("select * from t").Check(testkit.Rows("1 5", "2 3", "3 4", "4 8", "6 8", "7 6")) + tk.MustQuery("select * from t").Check(testkit.Rows("2 3", "3 4", "1 5", "7 6", "4 8", "6 8")) tk.MustQuery("select * from t where a = 1").Check(testkit.Rows("1 5")) tk.MustQuery("select * from t order by a desc").Check(testkit.Rows("7 6", "6 8", "4 8", "3 4", "2 3", "1 5")) tk.MustQuery("select * from t order by b, a").Check(testkit.Rows("2 3", "3 4", "1 5", "7 6", "4 8", "6 8")) @@ -36,13 +36,13 @@ func (s *testSuite4) TestDirtyTransaction(c *C) { tk.MustQuery("select b from t where b = 8 order by b desc").Check(testkit.Rows("8", "8")) // Delete a snapshot row and a dirty row. tk.MustExec("delete from t where a = 2 or a = 3") - tk.MustQuery("select * from t").Check(testkit.Rows("1 5", "4 8", "6 8", "7 6")) + tk.MustQuery("select * from t").Check(testkit.Rows("1 5", "7 6", "4 8", "6 8")) tk.MustQuery("select * from t order by a desc").Check(testkit.Rows("7 6", "6 8", "4 8", "1 5")) tk.MustQuery("select * from t order by b, a").Check(testkit.Rows("1 5", "7 6", "4 8", "6 8")) tk.MustQuery("select * from t order by b desc, a desc").Check(testkit.Rows("6 8", "4 8", "7 6", "1 5")) // Add deleted row back. tk.MustExec("insert t values (2, 3), (3, 4)") - tk.MustQuery("select * from t").Check(testkit.Rows("1 5", "2 3", "3 4", "4 8", "6 8", "7 6")) + tk.MustQuery("select * from t").Check(testkit.Rows("2 3", "3 4", "1 5", "7 6", "4 8", "6 8")) tk.MustQuery("select * from t order by a desc").Check(testkit.Rows("7 6", "6 8", "4 8", "3 4", "2 3", "1 5")) tk.MustQuery("select * from t order by b, a").Check(testkit.Rows("2 3", "3 4", "1 5", "7 6", "4 8", "6 8")) tk.MustQuery("select * from t order by b desc, a desc").Check(testkit.Rows("6 8", "4 8", "7 6", "1 5", "3 4", "2 3")) From 8194948df9ab78e326773cf0797c006c71f43361 Mon Sep 17 00:00:00 2001 From: francis0407 Date: Tue, 10 Sep 2019 12:27:56 +0800 Subject: [PATCH 7/7] fix join_test --- executor/join_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/executor/join_test.go b/executor/join_test.go index 550898be5e2dd..6c2211538be29 100644 --- a/executor/join_test.go +++ b/executor/join_test.go @@ -832,8 +832,8 @@ func (s *testSuite2) TestIndexLookupJoin(c *C) { tk.MustExec("CREATE INDEX idx_s_a ON s(`a`)") tk.MustExec("INSERT INTO s VALUES (-277544960, 'fpnndsjo') , (2, 'kfpnndsjof') , (2, 'vtdiockfpn'), (-277544960, 'fpnndsjo') , (2, 'kfpnndsjof') , (6, 'ckfp')") tk.MustQuery("select /*+ TIDB_INLJ(t, s) */ t.a from t join s on t.a = s.a").Check(testkit.Rows("-277544960", "-277544960")) - tk.MustQuery("select /*+ TIDB_INLJ(t, s) */ t.a from t left join s on t.a = s.a"). Check(testkit.Rows("-1327693824", "-277544960", "-277544960", "148307968")) - tk.MustQuery("select /*+ TIDB_INLJ(t, s) */ t.a from t right join s on t.a = s.a").Check(testkit.Rows("-277544960", "-277544960","", "", "", "")) + tk.MustQuery("select /*+ TIDB_INLJ(t, s) */ t.a from t left join s on t.a = s.a").Check(testkit.Rows("-1327693824", "-277544960", "-277544960", "148307968")) + tk.MustQuery("select /*+ TIDB_INLJ(t, s) */ t.a from t right join s on t.a = s.a").Check(testkit.Rows("-277544960", "-277544960", "", "", "", "")) tk.MustExec("DROP TABLE IF EXISTS t;") tk.MustExec("CREATE TABLE t(a BIGINT PRIMARY KEY, b BIGINT);") tk.MustExec("INSERT INTO t VALUES(1, 2);")