From 5fa9da1bf7ecd0e0ce08d66acf61b62736cfda16 Mon Sep 17 00:00:00 2001 From: Zhou Kunqin <25057648+time-and-fate@users.noreply.github.com> Date: Mon, 17 Oct 2022 18:45:53 +0800 Subject: [PATCH] planner: make the meaning of displayed estimated row count consistent with actual row count (#38188) close pingcap/tidb#38187 --- cmd/explaintest/r/cte.result | 26 +- cmd/explaintest/r/explain_complex.result | 32 +- .../r/explain_complex_stats.result | 16 +- cmd/explaintest/r/explain_cte.result | 16 +- cmd/explaintest/r/explain_easy.result | 144 +++---- cmd/explaintest/r/explain_easy_stats.result | 10 +- cmd/explaintest/r/explain_join_stats.result | 10 +- cmd/explaintest/r/explain_union_scan.result | 10 +- cmd/explaintest/r/index_join.result | 10 +- cmd/explaintest/r/index_merge.result | 26 +- cmd/explaintest/r/subquery.result | 20 +- cmd/explaintest/r/topn_push_down.result | 46 +- cmd/explaintest/r/tpch.result | 72 ++-- executor/explainfor_test.go | 4 +- executor/index_lookup_join_test.go | 4 +- executor/join_test.go | 54 +-- executor/partition_table_test.go | 118 +++--- executor/prepared_test.go | 8 +- planner/core/common_plans.go | 22 +- planner/core/encode.go | 14 +- planner/core/flat_plan.go | 6 +- planner/core/integration_test.go | 38 +- planner/core/optimizer.go | 37 ++ planner/core/physical_plans.go | 4 + planner/core/plan.go | 80 ++++ planner/core/plan_cost_ver1.go | 3 +- planner/core/point_get_plan.go | 44 ++ planner/core/testdata/analyze_suite_out.json | 32 +- .../core/testdata/enforce_mpp_suite_out.json | 8 +- .../core/testdata/integration_suite_out.json | 396 +++++++++--------- .../core/testdata/join_reorder_suite_out.json | 332 +++++++-------- .../core/testdata/partition_pruner_out.json | 60 +-- .../testdata/plan_normalized_suite_out.json | 2 +- planner/core/testdata/plan_suite_out.json | 290 ++++++------- planner/core/testdata/stats_suite_out.json | 22 +- util/ranger/testdata/ranger_suite_out.json | 12 +- 36 files changed, 1104 insertions(+), 924 deletions(-) diff --git a/cmd/explaintest/r/cte.result b/cmd/explaintest/r/cte.result index cf427c05a181c..e3a740e50445f 100644 --- a/cmd/explaintest/r/cte.result +++ b/cmd/explaintest/r/cte.result @@ -594,11 +594,11 @@ Projection_16 10000.00 root test.t1.c1, test.t1.c2 └─Apply_18 10000.00 root CARTESIAN inner join, other cond:or(and(gt(test.t1.c1, Column#11), if(ne(Column#12, 0), NULL, 1)), or(eq(Column#13, 0), if(isnull(test.t1.c1), NULL, 0))) ├─TableReader_20(Build) 10000.00 root data:TableFullScan_19 │ └─TableFullScan_19 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo - └─StreamAgg_35(Probe) 1.00 root funcs:max(Column#19)->Column#11, funcs:sum(Column#20)->Column#12, funcs:count(Column#21)->Column#13 - └─TableReader_36 1.00 root data:StreamAgg_24 - └─StreamAgg_24 1.00 cop[tikv] funcs:max(test.t2.c1)->Column#19, funcs:sum(isnull(test.t2.c1))->Column#20, funcs:count(1)->Column#21 - └─Selection_34 10.00 cop[tikv] eq(test.t2.c2, test.t1.c2) - └─TableFullScan_33 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo + └─StreamAgg_35(Probe) 10000.00 root funcs:max(Column#19)->Column#11, funcs:sum(Column#20)->Column#12, funcs:count(Column#21)->Column#13 + └─TableReader_36 10000.00 root data:StreamAgg_24 + └─StreamAgg_24 10000.00 cop[tikv] funcs:max(test.t2.c1)->Column#19, funcs:sum(isnull(test.t2.c1))->Column#20, funcs:count(1)->Column#21 + └─Selection_34 100000.00 cop[tikv] eq(test.t2.c2, test.t1.c2) + └─TableFullScan_33 100000000.00 cop[tikv] table:t2 keep order:false, stats:pseudo select * from t1 where c1 > all(with cte1 as (select c1 from t2 where t2.c2 = t1.c2) select c1 from cte1); c1 c2 2 1 @@ -624,9 +624,9 @@ Projection_26 10000.00 root test.t1.c1, test.t1.c2 └─Apply_28 10000.00 root CARTESIAN inner join, other cond:or(and(gt(test.t1.c1, Column#14), if(ne(Column#15, 0), NULL, 1)), or(eq(Column#16, 0), if(isnull(test.t1.c1), NULL, 0))) ├─TableReader_30(Build) 10000.00 root data:TableFullScan_29 │ └─TableFullScan_29 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo - └─HashAgg_31(Probe) 1.00 root funcs:max(Column#19)->Column#14, funcs:sum(Column#20)->Column#15, funcs:count(1)->Column#16 - └─Projection_35 20.00 root test.t2.c1, cast(isnull(test.t2.c1), decimal(20,0) BINARY)->Column#20 - └─CTEFullScan_33 20.00 root CTE:cte1 data:CTE_0 + └─HashAgg_31(Probe) 10000.00 root funcs:max(Column#19)->Column#14, funcs:sum(Column#20)->Column#15, funcs:count(1)->Column#16 + └─Projection_35 200000.00 root test.t2.c1, cast(isnull(test.t2.c1), decimal(20,0) BINARY)->Column#20 + └─CTEFullScan_33 200000.00 root CTE:cte1 data:CTE_0 CTE_0 20.00 root Recursive CTE, limit(offset:0, count:1) ├─Projection_19(Seed Part) 10.00 root test.t2.c1 │ └─TableReader_22 10.00 root data:Selection_21 @@ -643,7 +643,7 @@ id estRows task access object operator info Apply_25 10000.00 root CARTESIAN semi join ├─TableReader_27(Build) 10000.00 root data:TableFullScan_26 │ └─TableFullScan_26 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo -└─CTEFullScan_28(Probe) 20.00 root CTE:cte1 data:CTE_0 +└─CTEFullScan_28(Probe) 200000.00 root CTE:cte1 data:CTE_0 CTE_0 20.00 root Recursive CTE, limit(offset:0, count:10) ├─Projection_17(Seed Part) 10.00 root test.t2.c1 │ └─TableReader_20 10.00 root data:Selection_19 @@ -662,9 +662,9 @@ Projection_24 10000.00 root test.t1.c1, test.t1.c2 └─Apply_26 10000.00 root CARTESIAN inner join, other cond:or(and(gt(test.t1.c1, Column#18), if(ne(Column#19, 0), NULL, 1)), or(eq(Column#20, 0), if(isnull(test.t1.c1), NULL, 0))) ├─TableReader_28(Build) 10000.00 root data:TableFullScan_27 │ └─TableFullScan_27 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo - └─HashAgg_29(Probe) 1.00 root funcs:max(Column#23)->Column#18, funcs:sum(Column#24)->Column#19, funcs:count(1)->Column#20 - └─Projection_33 18000.00 root test.t2.c1, cast(isnull(test.t2.c1), decimal(20,0) BINARY)->Column#24 - └─CTEFullScan_31 18000.00 root CTE:cte1 data:CTE_0 + └─HashAgg_29(Probe) 10000.00 root funcs:max(Column#23)->Column#18, funcs:sum(Column#24)->Column#19, funcs:count(1)->Column#20 + └─Projection_33 180000000.00 root test.t2.c1, cast(isnull(test.t2.c1), decimal(20,0) BINARY)->Column#24 + └─CTEFullScan_31 180000000.00 root CTE:cte1 data:CTE_0 CTE_0 18000.00 root Recursive CTE ├─TableReader_19(Seed Part) 10000.00 root data:TableFullScan_18 │ └─TableFullScan_18 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo @@ -678,7 +678,7 @@ id estRows task access object operator info Apply_23 10000.00 root CARTESIAN semi join ├─TableReader_25(Build) 10000.00 root data:TableFullScan_24 │ └─TableFullScan_24 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo -└─CTEFullScan_26(Probe) 18000.00 root CTE:cte1 data:CTE_0 +└─CTEFullScan_26(Probe) 180000000.00 root CTE:cte1 data:CTE_0 CTE_0 18000.00 root Recursive CTE ├─TableReader_17(Seed Part) 10000.00 root data:TableFullScan_16 │ └─TableFullScan_16 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo diff --git a/cmd/explaintest/r/explain_complex.result b/cmd/explaintest/r/explain_complex.result index b68393c99fcfe..b9e292ac8b2a3 100644 --- a/cmd/explaintest/r/explain_complex.result +++ b/cmd/explaintest/r/explain_complex.result @@ -138,9 +138,9 @@ Projection 0.00 root test.st.id, test.dd.id, test.st.aid, test.st.cm, test.dd.d │ └─Selection(Probe) 0.00 cop[tikv] eq(test.st.bm, 0), eq(test.st.dit, "mac"), eq(test.st.pt, "ios"), not(isnull(test.st.dic)) │ └─TableRowIDScan 3333.33 cop[tikv] table:gad keep order:false, stats:pseudo └─IndexLookUp(Probe) 0.00 root - ├─IndexRangeScan(Build) 10000.00 cop[tikv] table:sdk, index:aid(aid, dic) range: decided by [eq(test.dd.aid, test.st.aid)], keep order:false, stats:pseudo + ├─IndexRangeScan(Build) 0.03 cop[tikv] table:sdk, index:aid(aid, dic) range: decided by [eq(test.dd.aid, test.st.aid)], keep order:false, stats:pseudo └─Selection(Probe) 0.00 cop[tikv] eq(test.dd.bm, 0), eq(test.dd.pt, "ios"), gt(test.dd.t, 1477971479), not(isnull(test.dd.mac)), not(isnull(test.dd.t)) - └─TableRowIDScan 10000.00 cop[tikv] table:sdk keep order:false, stats:pseudo + └─TableRowIDScan 0.03 cop[tikv] table:sdk keep order:false, stats:pseudo explain format = 'brief' SELECT cm, p1, p2, p3, p4, p5, p6_md5, p7_md5, count(1) as click_pv, count(DISTINCT ip) as click_ip FROM st WHERE (t between 1478188800 and 1478275200) and aid='cn.sbkcq' and pt='android' GROUP BY cm, p1, p2, p3, p4, p5, p6_md5, p7_md5; id estRows task access object operator info Projection 1.00 root test.st.cm, test.st.p1, test.st.p2, test.st.p3, test.st.p4, test.st.p5, test.st.p6_md5, test.st.p7_md5, Column#20, Column#21 @@ -157,11 +157,11 @@ Projection 0.01 root test.dt.id, test.dt.aid, test.dt.pt, test.dt.dic, test.dt. ├─TableReader(Build) 3.33 root data:Selection │ └─Selection 3.33 cop[tikv] eq(test.rr.pt, "ios"), gt(test.rr.t, 1478185592) │ └─TableFullScan 10000.00 cop[tikv] table:rr keep order:false, stats:pseudo - └─IndexLookUp(Probe) 0.00 root - ├─Selection(Build) 1.00 cop[tikv] not(isnull(test.dt.dic)) - │ └─IndexRangeScan 1.00 cop[tikv] table:dt, index:aid(aid, dic) range: decided by [eq(test.dt.aid, test.rr.aid) eq(test.dt.dic, test.rr.dic)], keep order:false, stats:pseudo - └─Selection(Probe) 0.00 cop[tikv] eq(test.dt.bm, 0), eq(test.dt.pt, "ios"), gt(test.dt.t, 1478185592) - └─TableRowIDScan 1.00 cop[tikv] table:dt keep order:false, stats:pseudo + └─IndexLookUp(Probe) 0.01 root + ├─Selection(Build) 3.33 cop[tikv] not(isnull(test.dt.dic)) + │ └─IndexRangeScan 3.33 cop[tikv] table:dt, index:aid(aid, dic) range: decided by [eq(test.dt.aid, test.rr.aid) eq(test.dt.dic, test.rr.dic)], keep order:false, stats:pseudo + └─Selection(Probe) 0.01 cop[tikv] eq(test.dt.bm, 0), eq(test.dt.pt, "ios"), gt(test.dt.t, 1478185592) + └─TableRowIDScan 3.33 cop[tikv] table:dt keep order:false, stats:pseudo explain format = 'brief' select pc,cr,count(DISTINCT uid) as pay_users,count(oid) as pay_times,sum(am) as am from pp where ps=2 and ppt>=1478188800 and ppt<1478275200 and pi in ('510017','520017') and uid in ('18089709','18090780') group by pc,cr; id estRows task access object operator info Projection 1.00 root test.pp.pc, test.pp.cr, Column#22, Column#23, Column#24 @@ -253,11 +253,11 @@ Sort 1.00 root test.org_department.left_value │ │ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:d, index:org_department_ctx_index(ctx) range:[1,1], keep order:false, stats:pseudo │ │ └─Selection(Probe) 0.01 cop[tikv] eq(test.org_department.status, 1000) │ │ └─TableRowIDScan 10.00 cop[tikv] table:d keep order:false, stats:pseudo - │ └─IndexLookUp(Probe) 1.25 root - │ ├─Selection(Build) 1250.00 cop[tikv] not(isnull(test.org_position.department_id)) - │ │ └─IndexRangeScan 1251.25 cop[tikv] table:p, index:org_position_department_id_index(department_id) range: decided by [eq(test.org_position.department_id, test.org_department.id)], keep order:false, stats:pseudo - │ └─Selection(Probe) 1.25 cop[tikv] eq(test.org_position.status, 1000) - │ └─TableRowIDScan 1250.00 cop[tikv] table:p keep order:false, stats:pseudo + │ └─IndexLookUp(Probe) 0.01 root + │ ├─Selection(Build) 12.50 cop[tikv] not(isnull(test.org_position.department_id)) + │ │ └─IndexRangeScan 12.51 cop[tikv] table:p, index:org_position_department_id_index(department_id) range: decided by [eq(test.org_position.department_id, test.org_department.id)], keep order:false, stats:pseudo + │ └─Selection(Probe) 0.01 cop[tikv] eq(test.org_position.status, 1000) + │ └─TableRowIDScan 12.50 cop[tikv] table:p keep order:false, stats:pseudo └─TableReader(Probe) 9.99 root data:Selection └─Selection 9.99 cop[tikv] eq(test.org_employee_position.status, 1000), not(isnull(test.org_employee_position.position_id)) └─TableFullScan 10000.00 cop[tikv] table:ep keep order:false, stats:pseudo @@ -278,10 +278,10 @@ Projection_8 15.62 root test.tab_a.name, test.tab_b.name, test.tab_a.amt, test. │ ├─TableReader_33(Build) 10.00 root data:Selection_32 │ │ └─Selection_32 10.00 cop[tikv] eq(test.tab_a.num, 112) │ │ └─TableFullScan_31 10000.00 cop[tikv] table:Tab_A keep order:false, stats:pseudo - │ └─TableReader_21(Probe) 1.00 root data:TableRangeScan_20 - │ └─TableRangeScan_20 1.00 cop[tikv] table:Tab_B range: decided by [test.tab_a.bid], keep order:false, stats:pseudo - └─TableReader_10(Probe) 1.00 root data:TableRangeScan_9 - └─TableRangeScan_9 1.00 cop[tikv] table:Tab_C range: decided by [test.tab_a.cid], keep order:false, stats:pseudo + │ └─TableReader_21(Probe) 10.00 root data:TableRangeScan_20 + │ └─TableRangeScan_20 10.00 cop[tikv] table:Tab_B range: decided by [test.tab_a.bid], keep order:false, stats:pseudo + └─TableReader_10(Probe) 12.50 root data:TableRangeScan_9 + └─TableRangeScan_9 12.50 cop[tikv] table:Tab_C range: decided by [test.tab_a.cid], keep order:false, stats:pseudo select Tab_A.name AAA,Tab_B.name BBB,Tab_A.amt Aamt, Tab_C.amt Bamt,IFNULL(Tab_C.amt, 0) FROM Tab_A left join Tab_B on Tab_A.bid=Tab_B.id left join Tab_C on Tab_A.cid=Tab_C.id and Tab_A.type='01' where Tab_A.num=112; AAA BBB Aamt Bamt IFNULL(Tab_C.amt, 0) A01 B01 111.00 22.00 22.00 diff --git a/cmd/explaintest/r/explain_complex_stats.result b/cmd/explaintest/r/explain_complex_stats.result index ed7021dbbfba2..a4c10029ac5a0 100644 --- a/cmd/explaintest/r/explain_complex_stats.result +++ b/cmd/explaintest/r/explain_complex_stats.result @@ -143,10 +143,10 @@ Projection 170.34 root test.st.id, test.dd.id, test.st.aid, test.st.cm, test.dd ├─TableReader(Build) 170.34 root data:Selection │ └─Selection 170.34 cop[tikv] eq(test.st.bm, 0), eq(test.st.dit, "mac"), eq(test.st.pt, "ios"), gt(test.st.t, 1477971479), not(isnull(test.st.dic)) │ └─TableFullScan 1999.00 cop[tikv] table:gad keep order:false - └─IndexLookUp(Probe) 1.00 root - ├─IndexRangeScan(Build) 3.93 cop[tikv] table:sdk, index:aid(aid, dic) range: decided by [eq(test.dd.aid, test.st.aid)], keep order:false - └─Selection(Probe) 1.00 cop[tikv] eq(test.dd.bm, 0), eq(test.dd.pt, "ios"), gt(test.dd.t, 1477971479), not(isnull(test.dd.mac)), not(isnull(test.dd.t)) - └─TableRowIDScan 3.93 cop[tikv] table:sdk keep order:false + └─IndexLookUp(Probe) 170.34 root + ├─IndexRangeScan(Build) 669.25 cop[tikv] table:sdk, index:aid(aid, dic) range: decided by [eq(test.dd.aid, test.st.aid)], keep order:false + └─Selection(Probe) 170.34 cop[tikv] eq(test.dd.bm, 0), eq(test.dd.pt, "ios"), gt(test.dd.t, 1477971479), not(isnull(test.dd.mac)), not(isnull(test.dd.t)) + └─TableRowIDScan 669.25 cop[tikv] table:sdk keep order:false explain format = 'brief' SELECT cm, p1, p2, p3, p4, p5, p6_md5, p7_md5, count(1) as click_pv, count(DISTINCT ip) as click_ip FROM st WHERE (t between 1478188800 and 1478275200) and aid='cn.sbkcq' and pt='android' GROUP BY cm, p1, p2, p3, p4, p5, p6_md5, p7_md5; id estRows task access object operator info Projection 39.28 root test.st.cm, test.st.p1, test.st.p2, test.st.p3, test.st.p4, test.st.p5, test.st.p6_md5, test.st.p7_md5, Column#20, Column#21 @@ -163,10 +163,10 @@ Projection 428.32 root test.dt.id, test.dt.aid, test.dt.pt, test.dt.dic, test.d ├─TableReader(Build) 428.32 root data:Selection │ └─Selection 428.32 cop[tikv] eq(test.dt.bm, 0), eq(test.dt.pt, "ios"), gt(test.dt.t, 1478185592), not(isnull(test.dt.dic)) │ └─TableFullScan 2000.00 cop[tikv] table:dt keep order:false - └─IndexLookUp(Probe) 1.00 root - ├─IndexRangeScan(Build) 1.00 cop[tikv] table:rr, index:PRIMARY(aid, dic) range: decided by [eq(test.rr.aid, test.dt.aid) eq(test.rr.dic, test.dt.dic)], keep order:false - └─Selection(Probe) 1.00 cop[tikv] eq(test.rr.pt, "ios"), gt(test.rr.t, 1478185592) - └─TableRowIDScan 1.00 cop[tikv] table:rr keep order:false + └─IndexLookUp(Probe) 428.32 root + ├─IndexRangeScan(Build) 428.32 cop[tikv] table:rr, index:PRIMARY(aid, dic) range: decided by [eq(test.rr.aid, test.dt.aid) eq(test.rr.dic, test.dt.dic)], keep order:false + └─Selection(Probe) 428.32 cop[tikv] eq(test.rr.pt, "ios"), gt(test.rr.t, 1478185592) + └─TableRowIDScan 428.32 cop[tikv] table:rr keep order:false explain format = 'brief' select pc,cr,count(DISTINCT uid) as pay_users,count(oid) as pay_times,sum(am) as am from pp where ps=2 and ppt>=1478188800 and ppt<1478275200 and pi in ('510017','520017') and uid in ('18089709','18090780') group by pc,cr; id estRows task access object operator info Projection 207.02 root test.pp.pc, test.pp.cr, Column#22, Column#23, Column#24 diff --git a/cmd/explaintest/r/explain_cte.result b/cmd/explaintest/r/explain_cte.result index 1d0653c4a4490..f740cad4b7867 100644 --- a/cmd/explaintest/r/explain_cte.result +++ b/cmd/explaintest/r/explain_cte.result @@ -113,8 +113,8 @@ id estRows task access object operator info Apply_24 10000.00 root CARTESIAN semi join ├─TableReader_26(Build) 10000.00 root data:TableFullScan_25 │ └─TableFullScan_25 10000.00 cop[tikv] table:dt keep order:false, stats:pseudo -└─Selection_29(Probe) 1.44 root eq(Column#8, 1) - └─CTEFullScan_30 1.80 root CTE:qn data:CTE_0 +└─Selection_29(Probe) 14400.00 root eq(Column#8, 1) + └─CTEFullScan_30 18000.00 root CTE:qn data:CTE_0 CTE_0 1.80 root Recursive CTE ├─Projection_17(Seed Part) 1.00 root plus(mul(test.t1.c1, 0), 1)->Column#4 │ └─TableDual_18 1.00 root rows:1 @@ -417,9 +417,9 @@ CTE_0 50.00 root Non-Recursive CTE │ │ └─TableReader(Probe) 9980.01 root data:Selection │ │ └─Selection 9980.01 cop[tikv] not(isnull(test.store_sales.ss_customer_sk)), not(isnull(test.store_sales.ss_sold_date_sk)) │ │ └─TableFullScan 10000.00 cop[tikv] table:store_sales keep order:false, stats:pseudo - │ └─IndexLookUp(Probe) 1.00 root - │ ├─IndexRangeScan(Build) 1.00 cop[tikv] table:customer, index:PRIMARY(c_customer_sk) range: decided by [eq(test.customer.c_customer_sk, test.store_sales.ss_customer_sk)], keep order:false, stats:pseudo - │ └─TableRowIDScan(Probe) 1.00 cop[tikv] table:customer keep order:false, stats:pseudo + │ └─IndexLookUp(Probe) 25.00 root + │ ├─IndexRangeScan(Build) 25.00 cop[tikv] table:customer, index:PRIMARY(c_customer_sk) range: decided by [eq(test.customer.c_customer_sk, test.store_sales.ss_customer_sk)], keep order:false, stats:pseudo + │ └─TableRowIDScan(Probe) 25.00 cop[tikv] table:customer keep order:false, stats:pseudo └─Projection 25.00 root test.customer.c_customer_id, test.customer.c_first_name, test.customer.c_last_name, test.customer.c_preferred_cust_flag, test.customer.c_birth_country, test.customer.c_login, test.customer.c_email_address, test.date_dim.d_year, Column#158, w->Column#169 └─Selection 25.00 root or(0, or(and(1, and(eq(test.date_dim.d_year, 2001), gt(Column#158, 0))), and(1, eq(test.date_dim.d_year, 2002)))) └─HashAgg 31.25 root group by:Column#250, Column#251, Column#252, Column#253, Column#254, Column#255, Column#256, Column#257, funcs:sum(Column#241)->Column#158, funcs:firstrow(Column#242)->test.customer.c_customer_id, funcs:firstrow(Column#243)->test.customer.c_first_name, funcs:firstrow(Column#244)->test.customer.c_last_name, funcs:firstrow(Column#245)->test.customer.c_preferred_cust_flag, funcs:firstrow(Column#246)->test.customer.c_birth_country, funcs:firstrow(Column#247)->test.customer.c_login, funcs:firstrow(Column#248)->test.customer.c_email_address, funcs:firstrow(Column#249)->test.date_dim.d_year @@ -433,9 +433,9 @@ CTE_0 50.00 root Non-Recursive CTE │ └─TableReader(Probe) 9980.01 root data:Selection │ └─Selection 9980.01 cop[tikv] not(isnull(test.web_sales.ws_bill_customer_sk)), not(isnull(test.web_sales.ws_sold_date_sk)) │ └─TableFullScan 10000.00 cop[tikv] table:web_sales keep order:false, stats:pseudo - └─IndexLookUp(Probe) 1.00 root - ├─IndexRangeScan(Build) 1.00 cop[tikv] table:customer, index:PRIMARY(c_customer_sk) range: decided by [eq(test.customer.c_customer_sk, test.web_sales.ws_bill_customer_sk)], keep order:false, stats:pseudo - └─TableRowIDScan(Probe) 1.00 cop[tikv] table:customer keep order:false, stats:pseudo + └─IndexLookUp(Probe) 25.00 root + ├─IndexRangeScan(Build) 25.00 cop[tikv] table:customer, index:PRIMARY(c_customer_sk) range: decided by [eq(test.customer.c_customer_sk, test.web_sales.ws_bill_customer_sk)], keep order:false, stats:pseudo + └─TableRowIDScan(Probe) 25.00 cop[tikv] table:customer keep order:false, stats:pseudo drop table if exists t1; create table t1 (id int, bench_type varchar(10),version varchar(10),tps int(20)); insert into t1 (id,bench_type,version,tps) values (1,'sysbench','5.4.0',1111111); diff --git a/cmd/explaintest/r/explain_easy.result b/cmd/explaintest/r/explain_easy.result index b1fd300e9705f..0686e19b77088 100644 --- a/cmd/explaintest/r/explain_easy.result +++ b/cmd/explaintest/r/explain_easy.result @@ -131,12 +131,12 @@ Projection 10000.00 root eq(test.t1.c2, test.t2.c2)->Column#11 └─Apply 10000.00 root CARTESIAN left outer join ├─TableReader(Build) 10000.00 root data:TableFullScan │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo - └─Limit(Probe) 1.00 root offset:0, count:1 - └─Projection 1.00 root test.t2.c1, test.t2.c2 - └─IndexLookUp 1.00 root - ├─Limit(Build) 1.00 cop[tikv] offset:0, count:1 - │ └─IndexRangeScan 1.00 cop[tikv] table:t2, index:c1(c1) range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true, stats:pseudo - └─TableRowIDScan(Probe) 1.00 cop[tikv] table:t2 keep order:false, stats:pseudo + └─Limit(Probe) 10000.00 root offset:0, count:1 + └─Projection 10000.00 root test.t2.c1, test.t2.c2 + └─IndexLookUp 10000.00 root + ├─Limit(Build) 10000.00 cop[tikv] offset:0, count:1 + │ └─IndexRangeScan 10000.00 cop[tikv] table:t2, index:c1(c1) range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true, stats:pseudo + └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo explain format = 'brief' select * from t1 order by c1 desc limit 1; id estRows task access object operator info Limit 1.00 root offset:0, count:1 @@ -324,38 +324,38 @@ Projection 10000.00 root Column#17 └─Apply 10000.00 root CARTESIAN left outer semi join, other cond:eq(test.t.c, Column#16) ├─TableReader(Build) 10000.00 root data:TableFullScan │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo - └─StreamAgg(Probe) 1.00 root funcs:count(1)->Column#16 - └─MergeJoin 12.50 root inner join, left key:test.t.a, right key:test.t.a - ├─TableReader(Build) 1.00 root data:TableRangeScan - │ └─TableRangeScan 1.00 cop[tikv] table:t1 range: decided by [eq(test.t.a, test.t.a)], keep order:true, stats:pseudo - └─TableReader(Probe) 1.00 root data:TableRangeScan - └─TableRangeScan 1.00 cop[tikv] table:s range: decided by [eq(test.t.a, test.t.a)], keep order:true, stats:pseudo + └─StreamAgg(Probe) 10000.00 root funcs:count(1)->Column#16 + └─MergeJoin 125000.00 root inner join, left key:test.t.a, right key:test.t.a + ├─TableReader(Build) 10000.00 root data:TableRangeScan + │ └─TableRangeScan 10000.00 cop[tikv] table:t1 range: decided by [eq(test.t.a, test.t.a)], keep order:true, stats:pseudo + └─TableReader(Probe) 10000.00 root data:TableRangeScan + └─TableRangeScan 10000.00 cop[tikv] table:s range: decided by [eq(test.t.a, test.t.a)], keep order:true, stats:pseudo explain format = 'brief' select t.c in (select count(*) from t s use index(idx), t t1 where s.b = t.a and s.a = t1.a) from t; id estRows task access object operator info Projection 10000.00 root Column#17 └─Apply 10000.00 root CARTESIAN left outer semi join, other cond:eq(test.t.c, Column#16) ├─TableReader(Build) 10000.00 root data:TableFullScan │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo - └─StreamAgg(Probe) 1.00 root funcs:count(1)->Column#16 - └─IndexJoin 12.50 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a) - ├─IndexReader(Build) 10.00 root index:IndexRangeScan - │ └─IndexRangeScan 10.00 cop[tikv] table:s, index:idx(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo - └─TableReader(Probe) 1.00 root data:TableRangeScan - └─TableRangeScan 1.00 cop[tikv] table:t1 range: decided by [test.t.a], keep order:false, stats:pseudo + └─StreamAgg(Probe) 10000.00 root funcs:count(1)->Column#16 + └─IndexJoin 125000.00 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a) + ├─IndexReader(Build) 100000.00 root index:IndexRangeScan + │ └─IndexRangeScan 100000.00 cop[tikv] table:s, index:idx(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo + └─TableReader(Probe) 100000.00 root data:TableRangeScan + └─TableRangeScan 100000.00 cop[tikv] table:t1 range: decided by [test.t.a], keep order:false, stats:pseudo explain format = 'brief' select t.c in (select count(*) from t s use index(idx), t t1 where s.b = t.a and s.c = t1.a) from t; id estRows task access object operator info Projection 10000.00 root Column#17 └─Apply 10000.00 root CARTESIAN left outer semi join, other cond:eq(test.t.c, Column#16) ├─TableReader(Build) 10000.00 root data:TableFullScan │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo - └─StreamAgg(Probe) 1.00 root funcs:count(1)->Column#16 - └─IndexJoin 12.49 root inner join, inner:TableReader, outer key:test.t.c, inner key:test.t.a, equal cond:eq(test.t.c, test.t.a) - ├─IndexLookUp(Build) 9.99 root - │ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:s, index:idx(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo - │ └─Selection(Probe) 9.99 cop[tikv] not(isnull(test.t.c)) - │ └─TableRowIDScan 10.00 cop[tikv] table:s keep order:false, stats:pseudo - └─TableReader(Probe) 1.00 root data:TableRangeScan - └─TableRangeScan 1.00 cop[tikv] table:t1 range: decided by [test.t.c], keep order:false, stats:pseudo + └─StreamAgg(Probe) 10000.00 root funcs:count(1)->Column#16 + └─IndexJoin 124875.00 root inner join, inner:TableReader, outer key:test.t.c, inner key:test.t.a, equal cond:eq(test.t.c, test.t.a) + ├─IndexLookUp(Build) 99900.00 root + │ ├─IndexRangeScan(Build) 100000.00 cop[tikv] table:s, index:idx(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo + │ └─Selection(Probe) 99900.00 cop[tikv] not(isnull(test.t.c)) + │ └─TableRowIDScan 100000.00 cop[tikv] table:s keep order:false, stats:pseudo + └─TableReader(Probe) 99900.00 root data:TableRangeScan + └─TableRangeScan 99900.00 cop[tikv] table:t1 range: decided by [test.t.c], keep order:false, stats:pseudo insert into t values(1, 1, 1), (2, 2 ,2), (3, 3, 3), (4, 3, 4),(5,3,5); analyze table t; explain format = 'brief' select t.c in (select count(*) from t s, t t1 where s.b = t.a and s.b = 3 and s.a = t1.a) from t; @@ -364,42 +364,42 @@ Projection 5.00 root Column#17 └─Apply 5.00 root CARTESIAN left outer semi join, other cond:eq(test.t.c, Column#16) ├─TableReader(Build) 5.00 root data:TableFullScan │ └─TableFullScan 5.00 cop[tikv] table:t keep order:false - └─StreamAgg(Probe) 1.00 root funcs:count(1)->Column#16 - └─MergeJoin 2.40 root inner join, left key:test.t.a, right key:test.t.a - ├─TableReader(Build) 4.00 root data:Selection - │ └─Selection 4.00 cop[tikv] eq(3, test.t.a) - │ └─TableFullScan 5.00 cop[tikv] table:t1 keep order:true - └─IndexReader(Probe) 2.40 root index:Selection - └─Selection 2.40 cop[tikv] eq(3, test.t.a) - └─IndexRangeScan 3.00 cop[tikv] table:s, index:idx(b) range:[3,3], keep order:true + └─StreamAgg(Probe) 5.00 root funcs:count(1)->Column#16 + └─MergeJoin 12.00 root inner join, left key:test.t.a, right key:test.t.a + ├─TableReader(Build) 20.00 root data:Selection + │ └─Selection 20.00 cop[tikv] eq(3, test.t.a) + │ └─TableFullScan 25.00 cop[tikv] table:t1 keep order:true + └─IndexReader(Probe) 12.00 root index:Selection + └─Selection 12.00 cop[tikv] eq(3, test.t.a) + └─IndexRangeScan 15.00 cop[tikv] table:s, index:idx(b) range:[3,3], keep order:true explain format = 'brief' select t.c in (select count(*) from t s left join t t1 on s.a = t1.a where 3 = t.a and s.b = 3) from t; id estRows task access object operator info Projection 5.00 root Column#17 └─Apply 5.00 root CARTESIAN left outer semi join, other cond:eq(test.t.c, Column#16) ├─TableReader(Build) 5.00 root data:TableFullScan │ └─TableFullScan 5.00 cop[tikv] table:t keep order:false - └─StreamAgg(Probe) 1.00 root funcs:count(1)->Column#16 - └─MergeJoin 2.40 root left outer join, left key:test.t.a, right key:test.t.a - ├─TableReader(Build) 4.00 root data:Selection - │ └─Selection 4.00 cop[tikv] eq(3, test.t.a) - │ └─TableFullScan 5.00 cop[tikv] table:t1 keep order:true - └─IndexReader(Probe) 2.40 root index:Selection - └─Selection 2.40 cop[tikv] eq(3, test.t.a) - └─IndexRangeScan 3.00 cop[tikv] table:s, index:idx(b) range:[3,3], keep order:true + └─StreamAgg(Probe) 5.00 root funcs:count(1)->Column#16 + └─MergeJoin 12.00 root left outer join, left key:test.t.a, right key:test.t.a + ├─TableReader(Build) 20.00 root data:Selection + │ └─Selection 20.00 cop[tikv] eq(3, test.t.a) + │ └─TableFullScan 25.00 cop[tikv] table:t1 keep order:true + └─IndexReader(Probe) 12.00 root index:Selection + └─Selection 12.00 cop[tikv] eq(3, test.t.a) + └─IndexRangeScan 15.00 cop[tikv] table:s, index:idx(b) range:[3,3], keep order:true explain format = 'brief' select t.c in (select count(*) from t s right join t t1 on s.a = t1.a where 3 = t.a and t1.b = 3) from t; id estRows task access object operator info Projection 5.00 root Column#17 └─Apply 5.00 root CARTESIAN left outer semi join, other cond:eq(test.t.c, Column#16) ├─TableReader(Build) 5.00 root data:TableFullScan │ └─TableFullScan 5.00 cop[tikv] table:t keep order:false - └─StreamAgg(Probe) 1.00 root funcs:count(1)->Column#16 - └─MergeJoin 2.40 root right outer join, left key:test.t.a, right key:test.t.a - ├─TableReader(Build) 4.00 root data:Selection - │ └─Selection 4.00 cop[tikv] eq(3, test.t.a) - │ └─TableFullScan 5.00 cop[tikv] table:s keep order:true - └─IndexReader(Probe) 2.40 root index:Selection - └─Selection 2.40 cop[tikv] eq(3, test.t.a) - └─IndexRangeScan 3.00 cop[tikv] table:t1, index:idx(b) range:[3,3], keep order:true + └─StreamAgg(Probe) 5.00 root funcs:count(1)->Column#16 + └─MergeJoin 12.00 root right outer join, left key:test.t.a, right key:test.t.a + ├─TableReader(Build) 20.00 root data:Selection + │ └─Selection 20.00 cop[tikv] eq(3, test.t.a) + │ └─TableFullScan 25.00 cop[tikv] table:s keep order:true + └─IndexReader(Probe) 12.00 root index:Selection + └─Selection 12.00 cop[tikv] eq(3, test.t.a) + └─IndexRangeScan 15.00 cop[tikv] table:t1, index:idx(b) range:[3,3], keep order:true drop table if exists t; create table t(a int unsigned not null); explain format = 'brief' select t.a = '123455' from t; @@ -525,8 +525,8 @@ StreamAgg 1.00 root funcs:count(1)->Column#22 │ └─TableReader 0.01 root data:Selection │ └─Selection 0.01 cop[tikv] eq(test.test01.period, 1), ge(test.test01.stat_date, 20191202), gt(cast(test.test01.registration_num, bigint(20) BINARY), 0), le(test.test01.stat_date, 20191202) │ └─TableFullScan 10000.00 cop[tikv] table:test01 keep order:false, stats:pseudo - └─TableReader(Probe) 1.00 root data:TableRangeScan - └─TableRangeScan 1.00 cop[tikv] table:b range: decided by [Column#16], keep order:false, stats:pseudo + └─TableReader(Probe) 2.00 root data:TableRangeScan + └─TableRangeScan 2.00 cop[tikv] table:b range: decided by [Column#16], keep order:false, stats:pseudo drop table if exists t; create table t(a int, nb int not null, nc int not null); explain format = 'brief' select ifnull(a, 0) from t; @@ -601,16 +601,16 @@ Projection 10000.00 root Column#22 └─Apply 10000.00 root left outer semi join, equal:[eq(test.t.nc, Column#21)] ├─TableReader(Build) 10000.00 root data:TableFullScan │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo - └─HashAgg(Probe) 1.00 root funcs:count(Column#23)->Column#21 - └─HashJoin 9.99 root inner join, equal:[eq(test.t.a, test.t.a)] - ├─HashAgg(Build) 7.99 root group by:test.t.a, funcs:count(Column#24)->Column#23, funcs:firstrow(test.t.a)->test.t.a - │ └─TableReader 7.99 root data:HashAgg - │ └─HashAgg 7.99 cop[tikv] group by:test.t.a, funcs:count(1)->Column#24 - │ └─Selection 9.99 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a)) - │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo - └─TableReader(Probe) 9.99 root data:Selection - └─Selection 9.99 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a)) - └─TableFullScan 10000.00 cop[tikv] table:s keep order:false, stats:pseudo + └─HashAgg(Probe) 10000.00 root funcs:count(Column#23)->Column#21 + └─HashJoin 99900.00 root inner join, equal:[eq(test.t.a, test.t.a)] + ├─HashAgg(Build) 79920.00 root group by:test.t.a, funcs:count(Column#24)->Column#23, funcs:firstrow(test.t.a)->test.t.a + │ └─TableReader 79920.00 root data:HashAgg + │ └─HashAgg 79920.00 cop[tikv] group by:test.t.a, funcs:count(1)->Column#24 + │ └─Selection 99900.00 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a)) + │ └─TableFullScan 100000000.00 cop[tikv] table:t1 keep order:false, stats:pseudo + └─TableReader(Probe) 99900.00 root data:Selection + └─Selection 99900.00 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a)) + └─TableFullScan 100000000.00 cop[tikv] table:s keep order:false, stats:pseudo explain format = 'brief' select * from t ta left outer join t tb on ta.nb = tb.nb and ta.a > 1 where ifnull(tb.a, 1) or tb.a is null; id estRows task access object operator info Selection 10000.00 root or(ifnull(test.t.a, 1), isnull(test.t.a)) @@ -635,16 +635,16 @@ Projection 10000.00 root Column#22 ├─Projection(Build) 10000.00 root test.t.a, ifnull(test.t.a, 1)->Column#23 │ └─TableReader 10000.00 root data:TableFullScan │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo - └─HashAgg(Probe) 1.00 root funcs:count(Column#25)->Column#21 - └─HashJoin 9.99 root inner join, equal:[eq(test.t.a, test.t.a)] - ├─HashAgg(Build) 7.99 root group by:test.t.a, funcs:count(Column#26)->Column#25, funcs:firstrow(test.t.a)->test.t.a - │ └─TableReader 7.99 root data:HashAgg - │ └─HashAgg 7.99 cop[tikv] group by:test.t.a, funcs:count(1)->Column#26 - │ └─Selection 9.99 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a)) - │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo - └─TableReader(Probe) 9.99 root data:Selection - └─Selection 9.99 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a)) - └─TableFullScan 10000.00 cop[tikv] table:s keep order:false, stats:pseudo + └─HashAgg(Probe) 10000.00 root funcs:count(Column#25)->Column#21 + └─HashJoin 99900.00 root inner join, equal:[eq(test.t.a, test.t.a)] + ├─HashAgg(Build) 79920.00 root group by:test.t.a, funcs:count(Column#26)->Column#25, funcs:firstrow(test.t.a)->test.t.a + │ └─TableReader 79920.00 root data:HashAgg + │ └─HashAgg 79920.00 cop[tikv] group by:test.t.a, funcs:count(1)->Column#26 + │ └─Selection 99900.00 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a)) + │ └─TableFullScan 100000000.00 cop[tikv] table:t1 keep order:false, stats:pseudo + └─TableReader(Probe) 99900.00 root data:Selection + └─Selection 99900.00 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a)) + └─TableFullScan 100000000.00 cop[tikv] table:s keep order:false, stats:pseudo drop table if exists t; create table t(a int); explain format = 'brief' select * from t where _tidb_rowid = 0; diff --git a/cmd/explaintest/r/explain_easy_stats.result b/cmd/explaintest/r/explain_easy_stats.result index c385377d512ff..6e3bac3bc0527 100644 --- a/cmd/explaintest/r/explain_easy_stats.result +++ b/cmd/explaintest/r/explain_easy_stats.result @@ -107,11 +107,11 @@ Projection 1999.00 root eq(test.t1.c2, test.t2.c2)->Column#11 └─Apply 1999.00 root CARTESIAN left outer join ├─TableReader(Build) 1999.00 root data:TableFullScan │ └─TableFullScan 1999.00 cop[tikv] table:t1 keep order:false - └─TopN(Probe) 1.00 root test.t2.c1, offset:0, count:1 - └─IndexLookUp 1.00 root - ├─TopN(Build) 1.00 cop[tikv] test.t2.c1, offset:0, count:1 - │ └─IndexRangeScan 2.48 cop[tikv] table:t2, index:c1(c1) range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:false - └─TableRowIDScan(Probe) 1.00 cop[tikv] table:t2 keep order:false + └─TopN(Probe) 1999.00 root test.t2.c1, offset:0, count:1 + └─IndexLookUp 1999.00 root + ├─TopN(Build) 1999.00 cop[tikv] test.t2.c1, offset:0, count:1 + │ └─IndexRangeScan 4960.02 cop[tikv] table:t2, index:c1(c1) range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:false + └─TableRowIDScan(Probe) 1999.00 cop[tikv] table:t2 keep order:false explain format = 'brief' select * from t1 order by c1 desc limit 1; id estRows task access object operator info Limit 1.00 root offset:0, count:1 diff --git a/cmd/explaintest/r/explain_join_stats.result b/cmd/explaintest/r/explain_join_stats.result index 15e68179c5085..f07377d7fd8c7 100644 --- a/cmd/explaintest/r/explain_join_stats.result +++ b/cmd/explaintest/r/explain_join_stats.result @@ -20,8 +20,8 @@ StreamAgg 1.00 root funcs:count(1)->Column#5 └─IndexJoin 19977.00 root inner join, inner:IndexLookUp, outer key:test.lo.a, inner key:test.e.a, equal cond:eq(test.lo.a, test.e.a) ├─TableReader(Build) 250.00 root data:TableFullScan │ └─TableFullScan 250.00 cop[tikv] table:lo keep order:false - └─IndexLookUp(Probe) 79.91 root - ├─Selection(Build) 4080.00 cop[tikv] not(isnull(test.e.a)) - │ └─IndexRangeScan 4080.00 cop[tikv] table:e, index:idx_a(a) range: decided by [eq(test.e.a, test.lo.a)], keep order:false - └─Selection(Probe) 79.91 cop[tikv] eq(test.e.b, 22336) - └─TableRowIDScan 4080.00 cop[tikv] table:e keep order:false + └─IndexLookUp(Probe) 19977.00 root + ├─Selection(Build) 1020000.00 cop[tikv] not(isnull(test.e.a)) + │ └─IndexRangeScan 1020000.00 cop[tikv] table:e, index:idx_a(a) range: decided by [eq(test.e.a, test.lo.a)], keep order:false + └─Selection(Probe) 19977.00 cop[tikv] eq(test.e.b, 22336) + └─TableRowIDScan 1020000.00 cop[tikv] table:e keep order:false diff --git a/cmd/explaintest/r/explain_union_scan.result b/cmd/explaintest/r/explain_union_scan.result index 1ef48623efd4a..d729667a85756 100644 --- a/cmd/explaintest/r/explain_union_scan.result +++ b/cmd/explaintest/r/explain_union_scan.result @@ -19,11 +19,11 @@ Limit 10.00 root offset:0, count:10 │ ├─UnionScan(Build) 10.00 root │ │ └─TableReader 10.00 root data:TableFullScan │ │ └─TableFullScan 10.00 cop[tikv] table:t2 keep order:false - │ └─UnionScan(Probe) 1.00 root gt(test.city.province_id, 1), lt(test.city.province_id, 100) - │ └─IndexLookUp 1.00 root - │ ├─IndexRangeScan(Build) 1.00 cop[tikv] table:t1, index:PRIMARY(id) range: decided by [eq(test.city.id, test.city.id)], keep order:false - │ └─Selection(Probe) 1.00 cop[tikv] gt(test.city.province_id, 1), lt(test.city.province_id, 100) - │ └─TableRowIDScan 1.00 cop[tikv] table:t1 keep order:false + │ └─UnionScan(Probe) 10.00 root gt(test.city.province_id, 1), lt(test.city.province_id, 100) + │ └─IndexLookUp 10.00 root + │ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t1, index:PRIMARY(id) range: decided by [eq(test.city.id, test.city.id)], keep order:false + │ └─Selection(Probe) 10.00 cop[tikv] gt(test.city.province_id, 1), lt(test.city.province_id, 100) + │ └─TableRowIDScan 10.00 cop[tikv] table:t1 keep order:false └─UnionScan(Probe) 536284.00 root gt(test.city.province_id, 1), lt(test.city.province_id, 100), not(isnull(test.city.province_id)) └─TableReader 536284.00 root data:Selection └─Selection 536284.00 cop[tikv] gt(test.city.province_id, 1), lt(test.city.province_id, 100), not(isnull(test.city.province_id)) diff --git a/cmd/explaintest/r/index_join.result b/cmd/explaintest/r/index_join.result index 771c95ad5e8b1..4ac9593d01f8a 100644 --- a/cmd/explaintest/r/index_join.result +++ b/cmd/explaintest/r/index_join.result @@ -36,8 +36,8 @@ id estRows task access object operator info IndexJoin 8000.00 root semi join, inner:IndexReader, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a) ├─TableReader(Build) 10000.00 root data:TableFullScan │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo -└─IndexReader(Probe) 1.25 root index:IndexRangeScan - └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo +└─IndexReader(Probe) 12500.00 root index:IndexRangeScan + └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo show warnings; Level Code Message set @@tidb_opt_insubq_to_join_and_agg=1; @@ -50,6 +50,6 @@ IndexJoin 10000.00 root inner join, inner:IndexLookUp, outer key:test.t2.a, inn ├─StreamAgg(Build) 8000.00 root group by:test.t2.a, funcs:firstrow(test.t2.a)->test.t2.a │ └─IndexReader 10000.00 root index:IndexFullScan │ └─IndexFullScan 10000.00 cop[tikv] table:t2, index:a(a) keep order:true, stats:pseudo -└─IndexLookUp(Probe) 1.25 root - ├─IndexRangeScan(Build) 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo - └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo +└─IndexLookUp(Probe) 10000.00 root + ├─IndexRangeScan(Build) 10000.00 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo + └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo diff --git a/cmd/explaintest/r/index_merge.result b/cmd/explaintest/r/index_merge.result index 3f2f26fd99e07..efe44020446e9 100644 --- a/cmd/explaintest/r/index_merge.result +++ b/cmd/explaintest/r/index_merge.result @@ -511,11 +511,11 @@ Sort_12 1841.86 root test.t1.c1 │ ├─IndexRangeScan_19(Build) 3323.33 cop[tikv] table:t1, index:c2(c2) range:[-inf,-1), keep order:false, stats:pseudo │ └─Selection_21(Probe) 1841.86 cop[tikv] lt(test.t1.c3, 10) │ └─TableRowIDScan_20 5542.21 cop[tikv] table:t1 keep order:false, stats:pseudo - └─MaxOneRow_23(Probe) 1.00 root - └─StreamAgg_35 2.00 root group by:test.t2.c1, funcs:avg(Column#17, Column#18)->Column#9 - └─IndexReader_36 2.00 root index:StreamAgg_27 - └─StreamAgg_27 2.00 cop[tikv] group by:test.t2.c1, funcs:count(test.t2.c1)->Column#17, funcs:sum(test.t2.c1)->Column#18 - └─IndexRangeScan_34 2.50 cop[tikv] table:t2, index:c1(c1) range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true, stats:pseudo + └─MaxOneRow_23(Probe) 1841.86 root + └─StreamAgg_35 3683.72 root group by:test.t2.c1, funcs:avg(Column#17, Column#18)->Column#9 + └─IndexReader_36 3683.72 root index:StreamAgg_27 + └─StreamAgg_27 3683.72 cop[tikv] group by:test.t2.c1, funcs:count(test.t2.c1)->Column#17, funcs:sum(test.t2.c1)->Column#18 + └─IndexRangeScan_34 4604.65 cop[tikv] table:t2, index:c1(c1) range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true, stats:pseudo select /*+ use_index_merge(t1) */ * from t1 where t1.c1 = (select avg(t2.c1) from t2 where t1.c1 = t2.c1 group by t2.c1) and (c1 < 10 or c2 < -1) and c3 < 10 order by 1; c1 c2 c3 1 1 1 @@ -534,14 +534,14 @@ Sort_16 1841.86 root test.t1.c1 │ ├─IndexRangeScan_23(Build) 3323.33 cop[tikv] table:t1, index:c2(c2) range:[-inf,-1), keep order:false, stats:pseudo │ └─Selection_25(Probe) 1841.86 cop[tikv] lt(test.t1.c3, 10) │ └─TableRowIDScan_24 5542.21 cop[tikv] table:t1 keep order:false, stats:pseudo - └─TopN_29(Probe) 1.00 root test.t2.c1, offset:2, count:1 - └─HashAgg_36 2660.44 root group by:Column#21, funcs:avg(Column#19)->Column#9, funcs:firstrow(Column#20)->test.t2.c1 - └─Projection_48 3325.55 root cast(test.t2.c1, decimal(10,0) BINARY)->Column#19, test.t2.c1, test.t2.c1 - └─IndexMerge_41 3325.55 root - ├─Selection_38(Build) 3.32 cop[tikv] eq(test.t1.c1, test.t2.c1) - │ └─IndexRangeScan_37 3323.33 cop[tikv] table:t2, index:c1(c1) range:[-inf,10), keep order:false, stats:pseudo - ├─IndexRangeScan_39(Build) 3323.33 cop[tikv] table:t2, index:c2(c2) range:[-inf,10), keep order:false, stats:pseudo - └─TableRowIDScan_40(Probe) 3325.55 cop[tikv] table:t2 keep order:false, stats:pseudo + └─TopN_29(Probe) 1841.86 root test.t2.c1, offset:2, count:1 + └─HashAgg_36 4900166.23 root group by:Column#21, funcs:avg(Column#19)->Column#9, funcs:firstrow(Column#20)->test.t2.c1 + └─Projection_48 6125207.79 root cast(test.t2.c1, decimal(10,0) BINARY)->Column#19, test.t2.c1, test.t2.c1 + └─IndexMerge_41 6125207.79 root + ├─Selection_38(Build) 6121.12 cop[tikv] eq(test.t1.c1, test.t2.c1) + │ └─IndexRangeScan_37 6121120.92 cop[tikv] table:t2, index:c1(c1) range:[-inf,10), keep order:false, stats:pseudo + ├─IndexRangeScan_39(Build) 6121120.92 cop[tikv] table:t2, index:c2(c2) range:[-inf,10), keep order:false, stats:pseudo + └─TableRowIDScan_40(Probe) 6125207.79 cop[tikv] table:t2 keep order:false, stats:pseudo select /*+ use_index_merge(t1) */ * from t1 where t1.c1 = (select /*+ use_index_merge(t2) */ avg(t2.c1) from t2 where t1.c1 = t2.c1 and t2.c1 < 10 or t2.c2 < 10 group by t2.c1 order by c1 limit 1 offset 2) and (c1 < 10 or c2 < -1) and c3 < 10 order by 1; c1 c2 c3 3 3 3 diff --git a/cmd/explaintest/r/subquery.result b/cmd/explaintest/r/subquery.result index cfb170dabf0cd..9ef7cc52e8ab5 100644 --- a/cmd/explaintest/r/subquery.result +++ b/cmd/explaintest/r/subquery.result @@ -21,12 +21,12 @@ Projection 5.00 root Column#22 └─Apply 5.00 root CARTESIAN left outer semi join, other cond:eq(test.t.c, Column#21) ├─TableReader(Build) 5.00 root data:TableFullScan │ └─TableFullScan 5.00 cop[tikv] table:t keep order:false - └─StreamAgg(Probe) 1.00 root funcs:count(1)->Column#21 - └─IndexJoin 0.22 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a) - ├─IndexReader(Build) 0.45 root index:IndexRangeScan - │ └─IndexRangeScan 0.45 cop[tikv] table:s, index:idx(b, c, d) range: decided by [eq(test.t.b, 1) eq(test.t.c, 1) eq(test.t.d, test.t.a)], keep order:false - └─TableReader(Probe) 1.00 root data:TableRangeScan - └─TableRangeScan 1.00 cop[tikv] table:t1 range: decided by [test.t.a], keep order:false + └─StreamAgg(Probe) 5.00 root funcs:count(1)->Column#21 + └─IndexJoin 1.12 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a) + ├─IndexReader(Build) 2.24 root index:IndexRangeScan + │ └─IndexRangeScan 2.24 cop[tikv] table:s, index:idx(b, c, d) range: decided by [eq(test.t.b, 1) eq(test.t.c, 1) eq(test.t.d, test.t.a)], keep order:false + └─TableReader(Probe) 2.24 root data:TableRangeScan + └─TableRangeScan 2.24 cop[tikv] table:t1 range: decided by [test.t.a], keep order:false drop table if exists t; create table t(a int, b int, c int); explain format = 'brief' select a from t t1 where t1.a = (select max(t2.a) from t t2 where t1.b=t2.b and t1.c=t2.b); @@ -58,10 +58,10 @@ id estRows task access object operator info Apply 10000.00 root CARTESIAN anti semi join, other cond:eq(test.stu.name, Column#8) ├─TableReader(Build) 10000.00 root data:TableFullScan │ └─TableFullScan 10000.00 cop[tikv] table:stu keep order:false, stats:pseudo -└─Projection(Probe) 10.00 root guo->Column#8 - └─TableReader 10.00 root data:Selection - └─Selection 10.00 cop[tikv] eq(test.exam.stu_id, test.stu.id) - └─TableFullScan 10000.00 cop[tikv] table:exam keep order:false, stats:pseudo +└─Projection(Probe) 100000.00 root guo->Column#8 + └─TableReader 100000.00 root data:Selection + └─Selection 100000.00 cop[tikv] eq(test.exam.stu_id, test.stu.id) + └─TableFullScan 100000000.00 cop[tikv] table:exam keep order:false, stats:pseudo select * from stu where stu.name not in (select 'guo' from exam where exam.stu_id = stu.id); id name set names utf8mb4; diff --git a/cmd/explaintest/r/topn_push_down.result b/cmd/explaintest/r/topn_push_down.result index f45d88ea56a5c..96a064c6e5e75 100644 --- a/cmd/explaintest/r/topn_push_down.result +++ b/cmd/explaintest/r/topn_push_down.result @@ -176,13 +176,13 @@ Limit 0.00 root offset:0, count:5 │ │ │ └─IndexRangeScan 10.00 cop[tikv] table:tr, index:idx_shop_identy_trade_status_business_type(shop_identy, trade_status, business_type, trade_pay_status, trade_type, delivery_type, source, biz_date) range:[810094178,810094178], keep order:false, stats:pseudo │ │ └─Selection(Probe) 0.00 cop[tikv] eq(test.tr.brand_identy, 32314), eq(test.tr.domain_type, 2) │ │ └─TableRowIDScan 0.00 cop[tikv] table:tr keep order:false, stats:pseudo - │ └─IndexLookUp(Probe) 1.25 root - │ ├─IndexRangeScan(Build) 50.00 cop[tikv] table:te, index:idx_trade_id(trade_id) range: decided by [eq(test.te.trade_id, test.tr.id)], keep order:false, stats:pseudo - │ └─Selection(Probe) 1.25 cop[tikv] ge(test.te.expect_time, 2018-04-23 00:00:00.000000), le(test.te.expect_time, 2018-04-23 23:59:59.000000) - │ └─TableRowIDScan 50.00 cop[tikv] table:te keep order:false, stats:pseudo - └─IndexReader(Probe) 1.25 root index:Selection - └─Selection 1.25 cop[tikv] not(isnull(test.p.relate_id)) - └─IndexRangeScan 1.25 cop[tikv] table:p, index:payment_relate_id(relate_id) range: decided by [eq(test.p.relate_id, test.tr.id)], keep order:false, stats:pseudo + │ └─IndexLookUp(Probe) 0.00 root + │ ├─IndexRangeScan(Build) 0.00 cop[tikv] table:te, index:idx_trade_id(trade_id) range: decided by [eq(test.te.trade_id, test.tr.id)], keep order:false, stats:pseudo + │ └─Selection(Probe) 0.00 cop[tikv] ge(test.te.expect_time, 2018-04-23 00:00:00.000000), le(test.te.expect_time, 2018-04-23 23:59:59.000000) + │ └─TableRowIDScan 0.00 cop[tikv] table:te keep order:false, stats:pseudo + └─IndexReader(Probe) 0.00 root index:Selection + └─Selection 0.00 cop[tikv] not(isnull(test.p.relate_id)) + └─IndexRangeScan 0.00 cop[tikv] table:p, index:payment_relate_id(relate_id) range: decided by [eq(test.p.relate_id, test.tr.id)], keep order:false, stats:pseudo desc select 1 as a from dual order by a limit 1; id estRows task access object operator info Projection_6 1.00 root 1->Column#1 @@ -197,24 +197,24 @@ Apply_15 9990.00 root semi join, equal:[eq(test.t1.a, test.t2.a)] ├─TableReader_18(Build) 9990.00 root data:Selection_17 │ └─Selection_17 9990.00 cop[tikv] not(isnull(test.t1.a)) │ └─TableFullScan_16 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo -└─Selection_19(Probe) 0.80 root not(isnull(test.t2.a)) - └─Limit_20 1.00 root offset:0, count:1 - └─TableReader_25 1.00 root data:Limit_24 - └─Limit_24 1.00 cop[tikv] offset:0, count:1 - └─Selection_23 1.00 cop[tikv] gt(test.t2.b, test.t1.b) - └─TableFullScan_22 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo +└─Selection_19(Probe) 7992.00 root not(isnull(test.t2.a)) + └─Limit_20 9990.00 root offset:0, count:1 + └─TableReader_25 9990.00 root data:Limit_24 + └─Limit_24 9990.00 cop[tikv] offset:0, count:1 + └─Selection_23 9990.00 cop[tikv] gt(test.t2.b, test.t1.b) + └─TableFullScan_22 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo desc select * from t1 where t1.a in (select a from (select t2.a as a, t1.b as b from t2 where t2.b > t1.b) x order by b limit 1); id estRows task access object operator info Apply_17 9990.00 root semi join, equal:[eq(test.t1.a, test.t2.a)] ├─TableReader_20(Build) 9990.00 root data:Selection_19 │ └─Selection_19 9990.00 cop[tikv] not(isnull(test.t1.a)) │ └─TableFullScan_18 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo -└─Selection_21(Probe) 0.80 root not(isnull(test.t2.a)) - └─Limit_23 1.00 root offset:0, count:1 - └─TableReader_28 1.00 root data:Limit_27 - └─Limit_27 1.00 cop[tikv] offset:0, count:1 - └─Selection_26 1.00 cop[tikv] gt(test.t2.b, test.t1.b) - └─TableFullScan_25 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo +└─Selection_21(Probe) 7992.00 root not(isnull(test.t2.a)) + └─Limit_23 9990.00 root offset:0, count:1 + └─TableReader_28 9990.00 root data:Limit_27 + └─Limit_27 9990.00 cop[tikv] offset:0, count:1 + └─Selection_26 9990.00 cop[tikv] gt(test.t2.b, test.t1.b) + └─TableFullScan_25 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo drop table if exists t; create table t(a int not null, index idx(a)); explain format = 'brief' select /*+ TIDB_INLJ(t2) */ * from t t1 join t t2 on t1.a = t2.a limit 5; @@ -223,8 +223,8 @@ Limit 5.00 root offset:0, count:5 └─IndexJoin 5.00 root inner join, inner:IndexReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a) ├─TableReader(Build) 4.00 root data:TableFullScan │ └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false, stats:pseudo - └─IndexReader(Probe) 1.25 root index:IndexRangeScan - └─IndexRangeScan 1.25 cop[tikv] table:t2, index:idx(a) range: decided by [eq(test.t.a, test.t.a)], keep order:false, stats:pseudo + └─IndexReader(Probe) 5.00 root index:IndexRangeScan + └─IndexRangeScan 5.00 cop[tikv] table:t2, index:idx(a) range: decided by [eq(test.t.a, test.t.a)], keep order:false, stats:pseudo explain format = 'brief' select /*+ TIDB_INLJ(t2) */ * from t t1 left join t t2 on t1.a = t2.a where t2.a is null limit 5; id estRows task access object operator info Limit 5.00 root offset:0, count:5 @@ -232,8 +232,8 @@ Limit 5.00 root offset:0, count:5 └─IndexJoin 5.00 root left outer join, inner:IndexReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a) ├─TableReader(Build) 4.00 root data:TableFullScan │ └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false, stats:pseudo - └─IndexReader(Probe) 1.25 root index:IndexRangeScan - └─IndexRangeScan 1.25 cop[tikv] table:t2, index:idx(a) range: decided by [eq(test.t.a, test.t.a)], keep order:false, stats:pseudo + └─IndexReader(Probe) 5.00 root index:IndexRangeScan + └─IndexRangeScan 5.00 cop[tikv] table:t2, index:idx(a) range: decided by [eq(test.t.a, test.t.a)], keep order:false, stats:pseudo explain format = 'brief' select /*+ TIDB_SMJ(t1, t2) */ * from t t1 join t t2 on t1.a = t2.a limit 5; id estRows task access object operator info Limit 5.00 root offset:0, count:5 diff --git a/cmd/explaintest/r/tpch.result b/cmd/explaintest/r/tpch.result index f1100126e8812..926dd1b2c4850 100644 --- a/cmd/explaintest/r/tpch.result +++ b/cmd/explaintest/r/tpch.result @@ -262,10 +262,10 @@ Projection 10.00 root tpch.lineitem.l_orderkey, Column#35, tpch.orders.o_orderd │ └─TableReader(Probe) 36870000.00 root data:Selection │ └─Selection 36870000.00 cop[tikv] lt(tpch.orders.o_orderdate, 1995-03-13 00:00:00.000000) │ └─TableFullScan 75000000.00 cop[tikv] table:orders keep order:false - └─IndexLookUp(Probe) 4.05 root - ├─IndexRangeScan(Build) 7.45 cop[tikv] table:lineitem, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.orders.o_orderkey)], keep order:false - └─Selection(Probe) 4.05 cop[tikv] gt(tpch.lineitem.l_shipdate, 1995-03-13 00:00:00.000000) - └─TableRowIDScan 7.45 cop[tikv] table:lineitem keep order:false + └─IndexLookUp(Probe) 91515927.49 root + ├─IndexRangeScan(Build) 168388203.74 cop[tikv] table:lineitem, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.orders.o_orderkey)], keep order:false + └─Selection(Probe) 91515927.49 cop[tikv] gt(tpch.lineitem.l_shipdate, 1995-03-13 00:00:00.000000) + └─TableRowIDScan 168388203.74 cop[tikv] table:lineitem keep order:false /* Q4 Order Priority Checking Query This query determines how well the order priority system is working and gives an assessment of customer satisfaction. @@ -303,10 +303,10 @@ Sort 1.00 root tpch.orders.o_orderpriority ├─TableReader(Build) 2925937.50 root data:Selection │ └─Selection 2925937.50 cop[tikv] ge(tpch.orders.o_orderdate, 1995-01-01 00:00:00.000000), lt(tpch.orders.o_orderdate, 1995-04-01 00:00:00.000000) │ └─TableFullScan 75000000.00 cop[tikv] table:orders keep order:false - └─IndexLookUp(Probe) 4.05 root - ├─IndexRangeScan(Build) 5.06 cop[tikv] table:lineitem, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.orders.o_orderkey)], keep order:false - └─Selection(Probe) 4.05 cop[tikv] lt(tpch.lineitem.l_commitdate, tpch.lineitem.l_receiptdate) - └─TableRowIDScan 5.06 cop[tikv] table:lineitem keep order:false + └─IndexLookUp(Probe) 11851908.75 root + ├─IndexRangeScan(Build) 14814885.94 cop[tikv] table:lineitem, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.orders.o_orderkey)], keep order:false + └─Selection(Probe) 11851908.75 cop[tikv] lt(tpch.lineitem.l_commitdate, tpch.lineitem.l_receiptdate) + └─TableRowIDScan 14814885.94 cop[tikv] table:lineitem keep order:false /* Q5 Local Supplier Volume Query This query lists the revenue volume done through local suppliers. @@ -469,8 +469,8 @@ Sort 769.96 root tpch.nation.n_name, tpch.nation.n_name, Column#50 │ └─TableReader(Probe) 91446230.29 root data:Selection │ └─Selection 91446230.29 cop[tikv] ge(tpch.lineitem.l_shipdate, 1995-01-01 00:00:00.000000), le(tpch.lineitem.l_shipdate, 1996-12-31 00:00:00.000000) │ └─TableFullScan 300005811.00 cop[tikv] table:lineitem keep order:false - └─TableReader(Probe) 1.00 root data:TableRangeScan - └─TableRangeScan 1.00 cop[tikv] table:orders range: decided by [tpch.lineitem.l_orderkey], keep order:false + └─TableReader(Probe) 24465505.20 root data:TableRangeScan + └─TableRangeScan 24465505.20 cop[tikv] table:orders range: decided by [tpch.lineitem.l_orderkey], keep order:false /* Q8 National Market Share Query This query determines how the market share of a given nation within a given region has changed over two years for @@ -548,9 +548,9 @@ Sort 719.02 root Column#62 │ └─TableReader(Probe) 22413367.93 root data:Selection │ └─Selection 22413367.93 cop[tikv] ge(tpch.orders.o_orderdate, 1995-01-01 00:00:00.000000), le(tpch.orders.o_orderdate, 1996-12-31 00:00:00.000000) │ └─TableFullScan 75000000.00 cop[tikv] table:orders keep order:false - └─IndexLookUp(Probe) 4.05 root - ├─IndexRangeScan(Build) 4.05 cop[tikv] table:lineitem, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.orders.o_orderkey)], keep order:false - └─TableRowIDScan(Probe) 4.05 cop[tikv] table:lineitem keep order:false + └─IndexLookUp(Probe) 90788402.51 root + ├─IndexRangeScan(Build) 90788402.51 cop[tikv] table:lineitem, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.orders.o_orderkey)], keep order:false + └─TableRowIDScan(Probe) 90788402.51 cop[tikv] table:lineitem keep order:false /* Q9 Product Type Profit Measure Query This query determines how much profit is made on a given line of parts, broken out by supplier nation and year. @@ -677,10 +677,10 @@ Projection 20.00 root tpch.customer.c_custkey, tpch.customer.c_name, Column#39, │ │ └─TableFullScan 25.00 cop[tikv] table:nation keep order:false │ └─TableReader(Probe) 7500000.00 root data:TableFullScan │ └─TableFullScan 7500000.00 cop[tikv] table:customer keep order:false - └─IndexLookUp(Probe) 4.05 root - ├─IndexRangeScan(Build) 16.44 cop[tikv] table:lineitem, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.orders.o_orderkey)], keep order:false - └─Selection(Probe) 4.05 cop[tikv] eq(tpch.lineitem.l_returnflag, "R") - └─TableRowIDScan 16.44 cop[tikv] table:lineitem keep order:false + └─IndexLookUp(Probe) 12222016.17 root + ├─IndexRangeScan(Build) 49605980.10 cop[tikv] table:lineitem, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.orders.o_orderkey)], keep order:false + └─Selection(Probe) 12222016.17 cop[tikv] eq(tpch.lineitem.l_returnflag, "R") + └─TableRowIDScan 49605980.10 cop[tikv] table:lineitem keep order:false /* Q11 Important Stock Identification Query This query finds the most important subset of suppliers' stock in a given nation. @@ -780,8 +780,8 @@ Sort 1.00 root tpch.lineitem.l_shipmode ├─TableReader(Build) 10023369.01 root data:Selection │ └─Selection 10023369.01 cop[tikv] ge(tpch.lineitem.l_receiptdate, 1997-01-01 00:00:00.000000), in(tpch.lineitem.l_shipmode, "RAIL", "FOB"), lt(tpch.lineitem.l_commitdate, tpch.lineitem.l_receiptdate), lt(tpch.lineitem.l_receiptdate, 1998-01-01 00:00:00.000000), lt(tpch.lineitem.l_shipdate, tpch.lineitem.l_commitdate) │ └─TableFullScan 300005811.00 cop[tikv] table:lineitem keep order:false - └─TableReader(Probe) 1.00 root data:TableRangeScan - └─TableRangeScan 1.00 cop[tikv] table:orders range: decided by [tpch.lineitem.l_orderkey], keep order:false + └─TableReader(Probe) 10023369.01 root data:TableRangeScan + └─TableRangeScan 10023369.01 cop[tikv] table:orders range: decided by [tpch.lineitem.l_orderkey], keep order:false /* Q13 Customer Distribution Query This query seeks relationships between customers and the size of their orders. @@ -851,8 +851,8 @@ Projection 1.00 root div(mul(100.00, Column#27), Column#28)->Column#29 ├─TableReader(Build) 4121984.49 root data:Selection │ └─Selection 4121984.49 cop[tikv] ge(tpch.lineitem.l_shipdate, 1996-12-01 00:00:00.000000), lt(tpch.lineitem.l_shipdate, 1997-01-01 00:00:00.000000) │ └─TableFullScan 300005811.00 cop[tikv] table:lineitem keep order:false - └─TableReader(Probe) 1.00 root data:TableRangeScan - └─TableRangeScan 1.00 cop[tikv] table:part range: decided by [tpch.lineitem.l_partkey], keep order:false + └─TableReader(Probe) 4121984.49 root data:TableRangeScan + └─TableRangeScan 4121984.49 cop[tikv] table:part range: decided by [tpch.lineitem.l_partkey], keep order:false /* Q15 Top Supplier Query This query determines the top supplier so it can be rewarded, given more business, or identified for special recognition. @@ -945,8 +945,8 @@ Sort 14.41 root Column#23:desc, tpch.part.p_brand, tpch.part.p_type, tpch.part. ├─TableReader(Build) 1200618.43 root data:Selection │ └─Selection 1200618.43 cop[tikv] in(tpch.part.p_size, 48, 19, 12, 4, 41, 7, 21, 39), ne(tpch.part.p_brand, "Brand#34"), not(like(tpch.part.p_type, "LARGE BRUSHED%", 92)) │ └─TableFullScan 10000000.00 cop[tikv] table:part keep order:false - └─IndexReader(Probe) 4.02 root index:IndexRangeScan - └─IndexRangeScan 4.02 cop[tikv] table:partsupp, index:PRIMARY(PS_PARTKEY, PS_SUPPKEY) range: decided by [eq(tpch.partsupp.ps_partkey, tpch.part.p_partkey)], keep order:false + └─IndexReader(Probe) 4829985.30 root index:IndexRangeScan + └─IndexRangeScan 4829985.30 cop[tikv] table:partsupp, index:PRIMARY(PS_PARTKEY, PS_SUPPKEY) range: decided by [eq(tpch.partsupp.ps_partkey, tpch.part.p_partkey)], keep order:false /* Q17 Small-Quantity-Order Revenue Query This query determines how much average yearly revenue would be lost if orders were no longer filled for small @@ -1167,9 +1167,9 @@ Sort 20000.00 root tpch.supplier.s_name │ ├─TableReader(Build) 80007.93 root data:Selection │ │ └─Selection 80007.93 cop[tikv] like(tpch.part.p_name, "green%", 92) │ │ └─TableFullScan 10000000.00 cop[tikv] table:part keep order:false - │ └─IndexLookUp(Probe) 4.02 root - │ ├─IndexRangeScan(Build) 4.02 cop[tikv] table:partsupp, index:PRIMARY(PS_PARTKEY, PS_SUPPKEY) range: decided by [eq(tpch.partsupp.ps_partkey, tpch.part.p_partkey)], keep order:false - │ └─TableRowIDScan(Probe) 4.02 cop[tikv] table:partsupp keep order:false + │ └─IndexLookUp(Probe) 321865.05 root + │ ├─IndexRangeScan(Build) 321865.05 cop[tikv] table:partsupp, index:PRIMARY(PS_PARTKEY, PS_SUPPKEY) range: decided by [eq(tpch.partsupp.ps_partkey, tpch.part.p_partkey)], keep order:false + │ └─TableRowIDScan(Probe) 321865.05 cop[tikv] table:partsupp keep order:false └─TableReader(Probe) 44189356.65 root data:Selection └─Selection 44189356.65 cop[tikv] ge(tpch.lineitem.l_shipdate, 1993-01-01 00:00:00.000000), lt(tpch.lineitem.l_shipdate, 1994-01-01 00:00:00.000000) └─TableFullScan 300005811.00 cop[tikv] table:lineitem keep order:false @@ -1238,16 +1238,16 @@ Projection 100.00 root tpch.supplier.s_name, Column#72 │ │ │ └─TableReader(Probe) 240004648.80 root data:Selection │ │ │ └─Selection 240004648.80 cop[tikv] gt(tpch.lineitem.l_receiptdate, tpch.lineitem.l_commitdate) │ │ │ └─TableFullScan 300005811.00 cop[tikv] table:l1 keep order:false - │ │ └─TableReader(Probe) 0.49 root data:Selection - │ │ └─Selection 0.49 cop[tikv] eq(tpch.orders.o_orderstatus, "F") - │ │ └─TableRangeScan 1.00 cop[tikv] table:orders range: decided by [tpch.lineitem.l_orderkey], keep order:false - │ └─IndexLookUp(Probe) 4.05 root - │ ├─IndexRangeScan(Build) 4.05 cop[tikv] table:l2, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.lineitem.l_orderkey)], keep order:false - │ └─TableRowIDScan(Probe) 4.05 cop[tikv] table:l2 keep order:false - └─IndexLookUp(Probe) 4.05 root - ├─IndexRangeScan(Build) 5.06 cop[tikv] table:l3, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.lineitem.l_orderkey)], keep order:false - └─Selection(Probe) 4.05 cop[tikv] gt(tpch.lineitem.l_receiptdate, tpch.lineitem.l_commitdate) - └─TableRowIDScan 5.06 cop[tikv] table:l3 keep order:false + │ │ └─TableReader(Probe) 5956106.20 root data:Selection + │ │ └─Selection 5956106.20 cop[tikv] eq(tpch.orders.o_orderstatus, "F") + │ │ └─TableRangeScan 12232752.60 cop[tikv] table:orders range: decided by [tpch.lineitem.l_orderkey], keep order:false + │ └─IndexLookUp(Probe) 49550432.16 root + │ ├─IndexRangeScan(Build) 49550432.16 cop[tikv] table:l2, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.lineitem.l_orderkey)], keep order:false + │ └─TableRowIDScan(Probe) 49550432.16 cop[tikv] table:l2 keep order:false + └─IndexLookUp(Probe) 39640345.73 root + ├─IndexRangeScan(Build) 49550432.16 cop[tikv] table:l3, index:PRIMARY(L_ORDERKEY, L_LINENUMBER) range: decided by [eq(tpch.lineitem.l_orderkey, tpch.lineitem.l_orderkey)], keep order:false + └─Selection(Probe) 39640345.73 cop[tikv] gt(tpch.lineitem.l_receiptdate, tpch.lineitem.l_commitdate) + └─TableRowIDScan 49550432.16 cop[tikv] table:l3 keep order:false /* Q22 Global Sales Opportunity Query The Global Sales Opportunity Query identifies geographies where there are customers who may be likely to make a diff --git a/executor/explainfor_test.go b/executor/explainfor_test.go index 21617c95aa1b7..cb22e8ce0a370 100644 --- a/executor/explainfor_test.go +++ b/executor/explainfor_test.go @@ -466,7 +466,7 @@ func TestPointGetUserVarPlanCache(t *testing.T) { ` │ └─Point_Get_43 1.00 root table:t2, index:idx_a(a) `, ` └─TableReader_13(Probe) 0.00 root data:Selection_12`, ` └─Selection_12 0.00 cop[tikv] eq(test.t1.a, 1)`, - ` └─TableRangeScan_11 1.00 cop[tikv] table:t1 range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo`)) + ` └─TableRangeScan_11 0.80 cop[tikv] table:t1 range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo`)) tk.MustExec("set @a=2") tk.MustQuery("execute stmt using @a").Check(testkit.Rows( @@ -482,7 +482,7 @@ func TestPointGetUserVarPlanCache(t *testing.T) { ` │ └─Point_Get_43 1.00 root table:t2, index:idx_a(a) `, ` └─TableReader_13(Probe) 0.00 root data:Selection_12`, ` └─Selection_12 0.00 cop[tikv] eq(test.t1.a, 2)`, - ` └─TableRangeScan_11 1.00 cop[tikv] table:t1 range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo`)) + ` └─TableRangeScan_11 0.80 cop[tikv] table:t1 range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo`)) tk.MustQuery("execute stmt using @a").Check(testkit.Rows( "2 4 2 2", )) diff --git a/executor/index_lookup_join_test.go b/executor/index_lookup_join_test.go index ef8b582fb151f..d37f3f8a1f743 100644 --- a/executor/index_lookup_join_test.go +++ b/executor/index_lookup_join_test.go @@ -433,8 +433,8 @@ PARTITIONS 1`) "[│ └─HashAgg_20 8.00 cop[tikv] group by:test.t2.prefiller, ]\n" + "[│ └─Selection_24 10.00 cop[tikv] eq(test.t2.postfiller, 1)]\n" + "[│ └─TableFullScan_23 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo]\n" + - "[└─TableReader_14(Probe) 1.00 root partition:all data:TableRangeScan_13]\n" + - "[ └─TableRangeScan_13 1.00 cop[tikv] table:t1 range: decided by [eq(test.t1.id, test.t2.prefiller)], keep order:false, stats:pseudo")) + "[└─TableReader_14(Probe) 8.00 root partition:all data:TableRangeScan_13]\n" + + "[ └─TableRangeScan_13 8.00 cop[tikv] table:t1 range: decided by [eq(test.t1.id, test.t2.prefiller)], keep order:false, stats:pseudo")) tk.MustQuery("show warnings").Check(testkit.Rows()) // without fix it fails with: "runtime error: index out of range [0] with length 0" tk.MustQuery("select /* +INL_JOIN(t1,t2) */ t1.id, t1.pc from t1 where id in ( select prefiller from t2 where t2.postfiller = 1 )").Check(testkit.Rows()) diff --git a/executor/join_test.go b/executor/join_test.go index 0b9c1aad9f8be..8df5d0a7125d9 100644 --- a/executor/join_test.go +++ b/executor/join_test.go @@ -1361,9 +1361,9 @@ func TestIndexLookupJoin(t *testing.T) { " ├─TableReader(Build) 64.00 root data:Selection", " │ └─Selection 64.00 cop[tikv] not(isnull(test.t.b))", " │ └─TableFullScan 64.00 cop[tikv] table:t keep order:false", - " └─IndexReader(Probe) 1.00 root index:Selection", - " └─Selection 1.00 cop[tikv] not(isnull(test.s.a)), not(isnull(test.s.b))", - " └─IndexRangeScan 1.00 cop[tikv] table:s, index:idx(a, b) range: decided by [eq(test.s.a, test.t.a) lt(test.s.b, test.t.b)], keep order:false")) + " └─IndexReader(Probe) 64.00 root index:Selection", + " └─Selection 64.00 cop[tikv] not(isnull(test.s.a)), not(isnull(test.s.b))", + " └─IndexRangeScan 64.00 cop[tikv] table:s, index:idx(a, b) range: decided by [eq(test.s.a, test.t.a) lt(test.s.b, test.t.b)], keep order:false")) tk.MustQuery("select /*+ TIDB_INLJ(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows("64")) tk.MustExec("set @@tidb_index_lookup_join_concurrency=1;") tk.MustQuery("select /*+ TIDB_INLJ(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows("64")) @@ -1374,9 +1374,9 @@ func TestIndexLookupJoin(t *testing.T) { " ├─TableReader(Build) 64.00 root data:Selection", " │ └─Selection 64.00 cop[tikv] not(isnull(test.t.b))", " │ └─TableFullScan 64.00 cop[tikv] table:t keep order:false", - " └─IndexReader(Probe) 1.00 root index:Selection", - " └─Selection 1.00 cop[tikv] not(isnull(test.s.a)), not(isnull(test.s.b))", - " └─IndexRangeScan 1.00 cop[tikv] table:s, index:idx(a, b) range: decided by [eq(test.s.a, test.t.a) lt(test.s.b, test.t.b)], keep order:true", + " └─IndexReader(Probe) 64.00 root index:Selection", + " └─Selection 64.00 cop[tikv] not(isnull(test.s.a)), not(isnull(test.s.b))", + " └─IndexRangeScan 64.00 cop[tikv] table:s, index:idx(a, b) range: decided by [eq(test.s.a, test.t.a) lt(test.s.b, test.t.b)], keep order:true", )) tk.MustQuery("select /*+ INL_MERGE_JOIN(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows("64")) tk.MustExec("set @@tidb_index_lookup_join_concurrency=1;") @@ -1388,9 +1388,9 @@ func TestIndexLookupJoin(t *testing.T) { " ├─TableReader(Build) 64.00 root data:Selection", " │ └─Selection 64.00 cop[tikv] not(isnull(test.t.b))", " │ └─TableFullScan 64.00 cop[tikv] table:t keep order:false", - " └─IndexReader(Probe) 1.00 root index:Selection", - " └─Selection 1.00 cop[tikv] not(isnull(test.s.a)), not(isnull(test.s.b))", - " └─IndexRangeScan 1.00 cop[tikv] table:s, index:idx(a, b) range: decided by [eq(test.s.a, test.t.a) lt(test.s.b, test.t.b)], keep order:false", + " └─IndexReader(Probe) 64.00 root index:Selection", + " └─Selection 64.00 cop[tikv] not(isnull(test.s.a)), not(isnull(test.s.b))", + " └─IndexRangeScan 64.00 cop[tikv] table:s, index:idx(a, b) range: decided by [eq(test.s.a, test.t.a) lt(test.s.b, test.t.b)], keep order:false", )) tk.MustQuery("select /*+ INL_HASH_JOIN(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b").Check(testkit.Rows("64")) tk.MustExec("set @@tidb_index_lookup_join_concurrency=1;") @@ -1434,8 +1434,8 @@ func TestIndexNestedLoopHashJoin(t *testing.T) { "IndexHashJoin 100.00 root left outer join, inner:TableReader, outer key:test.t.a, inner key:test.s.a, equal cond:eq(test.t.a, test.s.a)", "├─TableReader(Build) 100.00 root data:TableFullScan", "│ └─TableFullScan 100.00 cop[tikv] table:t keep order:true", - "└─TableReader(Probe) 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:s range: decided by [test.t.a], keep order:false", + "└─TableReader(Probe) 100.00 root data:TableRangeScan", + " └─TableRangeScan 100.00 cop[tikv] table:s range: decided by [test.t.a], keep order:false", )) rs := tk.MustQuery("select /*+ INL_HASH_JOIN(s) */ * from t left join s on t.a=s.a order by t.pk") for i, row := range rs.Rows() { @@ -1471,10 +1471,10 @@ func TestIndexNestedLoopHashJoin(t *testing.T) { " ├─TableReader(Build) 9.00 root data:Selection", " │ └─Selection 9.00 cop[tikv] not(isnull(test.t.l_suppkey))", " │ └─TableFullScan 9.00 cop[tikv] table:l1 keep order:false", - " └─IndexLookUp(Probe) 3.00 root ", - " ├─IndexRangeScan(Build) 3.00 cop[tikv] table:l2, index:PRIMARY(l_orderkey, l_linenumber) range: decided by [eq(test.t.l_orderkey, test.t.l_orderkey)], keep order:false", - " └─Selection(Probe) 3.00 cop[tikv] not(isnull(test.t.l_suppkey))", - " └─TableRowIDScan 3.00 cop[tikv] table:l2 keep order:false")) + " └─IndexLookUp(Probe) 27.00 root ", + " ├─IndexRangeScan(Build) 27.00 cop[tikv] table:l2, index:PRIMARY(l_orderkey, l_linenumber) range: decided by [eq(test.t.l_orderkey, test.t.l_orderkey)], keep order:false", + " └─Selection(Probe) 27.00 cop[tikv] not(isnull(test.t.l_suppkey))", + " └─TableRowIDScan 27.00 cop[tikv] table:l2 keep order:false")) tk.MustQuery("select * from t l1 where exists ( select * from t l2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey )order by `l_orderkey`,`l_linenumber`;").Check(testkit.Rows("0 0 0 0", "0 1 0 1", "0 2 0 0", "1 0 1 0", "1 1 1 1", "1 2 1 0", "2 0 0 0", "2 1 0 1", "2 2 0 0")) tk.MustQuery("desc format = 'brief' select count(*) from t l1 where exists ( select * from t l2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey );").Check(testkit.Rows( "StreamAgg 1.00 root funcs:count(1)->Column#11", @@ -1482,10 +1482,10 @@ func TestIndexNestedLoopHashJoin(t *testing.T) { " ├─TableReader(Build) 9.00 root data:Selection", " │ └─Selection 9.00 cop[tikv] not(isnull(test.t.l_suppkey))", " │ └─TableFullScan 9.00 cop[tikv] table:l1 keep order:false", - " └─IndexLookUp(Probe) 3.00 root ", - " ├─IndexRangeScan(Build) 3.00 cop[tikv] table:l2, index:PRIMARY(l_orderkey, l_linenumber) range: decided by [eq(test.t.l_orderkey, test.t.l_orderkey)], keep order:false", - " └─Selection(Probe) 3.00 cop[tikv] not(isnull(test.t.l_suppkey))", - " └─TableRowIDScan 3.00 cop[tikv] table:l2 keep order:false")) + " └─IndexLookUp(Probe) 27.00 root ", + " ├─IndexRangeScan(Build) 27.00 cop[tikv] table:l2, index:PRIMARY(l_orderkey, l_linenumber) range: decided by [eq(test.t.l_orderkey, test.t.l_orderkey)], keep order:false", + " └─Selection(Probe) 27.00 cop[tikv] not(isnull(test.t.l_suppkey))", + " └─TableRowIDScan 27.00 cop[tikv] table:l2 keep order:false")) tk.MustQuery("select count(*) from t l1 where exists ( select * from t l2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey );").Check(testkit.Rows("9")) tk.MustExec("DROP TABLE IF EXISTS t, s") @@ -1579,9 +1579,9 @@ func TestIssue13449(t *testing.T) { "IndexHashJoin 12487.50 root inner join, inner:IndexReader, outer key:test.t.a, inner key:test.s.a, equal cond:eq(test.t.a, test.s.a)", "├─IndexReader(Build) 9990.00 root index:IndexFullScan", "│ └─IndexFullScan 9990.00 cop[tikv] table:t, index:a(a) keep order:true, stats:pseudo", - "└─IndexReader(Probe) 1.25 root index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test.s.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo")) + "└─IndexReader(Probe) 12487.50 root index:Selection", + " └─Selection 12487.50 cop[tikv] not(isnull(test.s.a))", + " └─IndexRangeScan 12500.00 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo")) tk.MustQuery("select /*+ INL_HASH_JOIN(s) */ * from t join s on t.a=s.a order by t.a;").Check(testkit.Rows("1 1", "128 128")) } @@ -2177,11 +2177,11 @@ func TestOuterTableBuildHashTableIsuse13933(t *testing.T) { "IndexHashJoin 12475.01 root left outer join, inner:IndexLookUp, outer key:test.t.b, inner key:test.s.b, equal cond:eq(test.t.b, test.s.b), other cond:lt(test.s.a, test.t.a)", "├─TableReader(Build) 10000.00 root data:TableFullScan", "│ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.s.b))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:s, index:b(b) range: decided by [eq(test.s.b, test.t.b)], keep order:false, stats:pseudo", - " └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.s.a))", - " └─TableRowIDScan 1.25 cop[tikv] table:s keep order:false, stats:pseudo")) + "└─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.s.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:s, index:b(b) range: decided by [eq(test.s.b, test.t.b)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.s.a))", + " └─TableRowIDScan 12487.50 cop[tikv] table:s keep order:false, stats:pseudo")) } func TestIssue13177(t *testing.T) { diff --git a/executor/partition_table_test.go b/executor/partition_table_test.go index 0d6b05b7b2640..3640b4e155097 100644 --- a/executor/partition_table_test.go +++ b/executor/partition_table_test.go @@ -602,10 +602,10 @@ func TestDirectReadingwithIndexJoin(t *testing.T) { "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test_dr_join.touter.b))", "│ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root partition:all ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test_dr_join.thash.b))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:thash, index:idx_b(b) range: decided by [eq(test_dr_join.thash.b, test_dr_join.touter.b)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:thash keep order:false, stats:pseudo")) // check if IndexLookUp is used + "└─IndexLookUp(Probe) 12487.50 root partition:all ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test_dr_join.thash.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:thash, index:idx_b(b) range: decided by [eq(test_dr_join.thash.b, test_dr_join.touter.b)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:thash keep order:false, stats:pseudo")) // check if IndexLookUp is used tk.MustQuery(queryPartition).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) // test tableReader + hash @@ -616,8 +616,8 @@ func TestDirectReadingwithIndexJoin(t *testing.T) { "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test_dr_join.touter.a))", "│ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo", - "└─TableReader(Probe) 1.00 root partition:all data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:thash range: decided by [test_dr_join.touter.a], keep order:false, stats:pseudo")) // check if tableReader is used + "└─TableReader(Probe) 9990.00 root partition:all data:TableRangeScan", + " └─TableRangeScan 9990.00 cop[tikv] table:thash range: decided by [test_dr_join.touter.a], keep order:false, stats:pseudo")) // check if tableReader is used tk.MustQuery(queryPartition).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) // test indexReader + hash @@ -628,9 +628,9 @@ func TestDirectReadingwithIndexJoin(t *testing.T) { "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test_dr_join.touter.b))", "│ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo", - "└─IndexReader(Probe) 1.25 root partition:all index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test_dr_join.thash.b))", - " └─IndexRangeScan 1.25 cop[tikv] table:thash, index:idx_b(b) range: decided by [eq(test_dr_join.thash.b, test_dr_join.touter.b)], keep order:false, stats:pseudo")) // check if indexReader is used + "└─IndexReader(Probe) 12487.50 root partition:all index:Selection", + " └─Selection 12487.50 cop[tikv] not(isnull(test_dr_join.thash.b))", + " └─IndexRangeScan 12500.00 cop[tikv] table:thash, index:idx_b(b) range: decided by [eq(test_dr_join.thash.b, test_dr_join.touter.b)], keep order:false, stats:pseudo")) // check if indexReader is used tk.MustQuery(queryPartition).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) // test indexLookUp + range @@ -642,10 +642,10 @@ func TestDirectReadingwithIndexJoin(t *testing.T) { "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test_dr_join.touter.b))", "│ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root partition:all ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test_dr_join.trange.b))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:trange, index:idx_b(b) range: decided by [eq(test_dr_join.trange.b, test_dr_join.touter.b)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:trange keep order:false, stats:pseudo")) // check if IndexLookUp is used + "└─IndexLookUp(Probe) 12487.50 root partition:all ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test_dr_join.trange.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:trange, index:idx_b(b) range: decided by [eq(test_dr_join.trange.b, test_dr_join.touter.b)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:trange keep order:false, stats:pseudo")) // check if IndexLookUp is used tk.MustQuery(queryPartition).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) // test tableReader + range @@ -656,8 +656,8 @@ func TestDirectReadingwithIndexJoin(t *testing.T) { "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test_dr_join.touter.a))", "│ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo", - "└─TableReader(Probe) 1.00 root partition:all data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:trange range: decided by [test_dr_join.touter.a], keep order:false, stats:pseudo")) // check if tableReader is used + "└─TableReader(Probe) 9990.00 root partition:all data:TableRangeScan", + " └─TableRangeScan 9990.00 cop[tikv] table:trange range: decided by [test_dr_join.touter.a], keep order:false, stats:pseudo")) // check if tableReader is used tk.MustQuery(queryPartition).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) // test indexReader + range @@ -669,9 +669,9 @@ func TestDirectReadingwithIndexJoin(t *testing.T) { "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test_dr_join.touter.b))", "│ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo", - "└─IndexReader(Probe) 1.25 root partition:all index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test_dr_join.trange.b))", - " └─IndexRangeScan 1.25 cop[tikv] table:trange, index:idx_b(b) range: decided by [eq(test_dr_join.trange.b, test_dr_join.touter.b)], keep order:false, stats:pseudo")) // check if indexReader is used + "└─IndexReader(Probe) 12487.50 root partition:all index:Selection", + " └─Selection 12487.50 cop[tikv] not(isnull(test_dr_join.trange.b))", + " └─IndexRangeScan 12500.00 cop[tikv] table:trange, index:idx_b(b) range: decided by [eq(test_dr_join.trange.b, test_dr_join.touter.b)], keep order:false, stats:pseudo")) // check if indexReader is used tk.MustQuery(queryPartition).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) } @@ -705,9 +705,9 @@ func TestDynamicPruningUnderIndexJoin(t *testing.T) { `├─TableReader(Build) 9990.00 root data:Selection`, `│ └─Selection 9990.00 cop[tikv] not(isnull(pruing_under_index_join.touter.b))`, `│ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`, - `└─IndexReader(Probe) 1.25 root partition:all index:Selection`, - ` └─Selection 1.25 cop[tikv] not(isnull(pruing_under_index_join.thash.b))`, - ` └─IndexRangeScan 1.25 cop[tikv] table:thash, index:idx_b(b) range: decided by [eq(pruing_under_index_join.thash.b, pruing_under_index_join.touter.b)], keep order:false, stats:pseudo`)) + `└─IndexReader(Probe) 12487.50 root partition:all index:Selection`, + ` └─Selection 12487.50 cop[tikv] not(isnull(pruing_under_index_join.thash.b))`, + ` └─IndexRangeScan 12500.00 cop[tikv] table:thash, index:idx_b(b) range: decided by [eq(pruing_under_index_join.thash.b, pruing_under_index_join.touter.b)], keep order:false, stats:pseudo`)) tk.MustQuery(`select /*+ INL_JOIN(touter, thash) */ thash.b from touter join thash use index(idx_b) on touter.b = thash.b`).Sort().Check( tk.MustQuery(`select /*+ INL_JOIN(touter, tnormal) */ tnormal.b from touter join tnormal use index(idx_b) on touter.b = tnormal.b`).Sort().Rows()) @@ -717,8 +717,8 @@ func TestDynamicPruningUnderIndexJoin(t *testing.T) { `├─TableReader(Build) 9990.00 root data:Selection`, `│ └─Selection 9990.00 cop[tikv] not(isnull(pruing_under_index_join.touter.b))`, `│ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`, - `└─TableReader(Probe) 1.00 root partition:all data:TableRangeScan`, - ` └─TableRangeScan 1.00 cop[tikv] table:thash range: decided by [pruing_under_index_join.touter.b], keep order:false, stats:pseudo`)) + `└─TableReader(Probe) 9990.00 root partition:all data:TableRangeScan`, + ` └─TableRangeScan 9990.00 cop[tikv] table:thash range: decided by [pruing_under_index_join.touter.b], keep order:false, stats:pseudo`)) tk.MustQuery(`select /*+ INL_JOIN(touter, thash) */ thash.* from touter join thash use index(primary) on touter.b = thash.a`).Sort().Check( tk.MustQuery(`select /*+ INL_JOIN(touter, tnormal) */ tnormal.* from touter join tnormal use index(primary) on touter.b = tnormal.a`).Sort().Rows()) @@ -728,10 +728,10 @@ func TestDynamicPruningUnderIndexJoin(t *testing.T) { `├─TableReader(Build) 9990.00 root data:Selection`, `│ └─Selection 9990.00 cop[tikv] not(isnull(pruing_under_index_join.touter.b))`, `│ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`, - `└─IndexLookUp(Probe) 1.25 root partition:all `, - ` ├─Selection(Build) 1.25 cop[tikv] not(isnull(pruing_under_index_join.thash.b))`, - ` │ └─IndexRangeScan 1.25 cop[tikv] table:thash, index:idx_b(b) range: decided by [eq(pruing_under_index_join.thash.b, pruing_under_index_join.touter.b)], keep order:false, stats:pseudo`, - ` └─TableRowIDScan(Probe) 1.25 cop[tikv] table:thash keep order:false, stats:pseudo`)) + `└─IndexLookUp(Probe) 12487.50 root partition:all `, + ` ├─Selection(Build) 12487.50 cop[tikv] not(isnull(pruing_under_index_join.thash.b))`, + ` │ └─IndexRangeScan 12500.00 cop[tikv] table:thash, index:idx_b(b) range: decided by [eq(pruing_under_index_join.thash.b, pruing_under_index_join.touter.b)], keep order:false, stats:pseudo`, + ` └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:thash keep order:false, stats:pseudo`)) tk.MustQuery(`select /*+ INL_JOIN(touter, thash) */ thash.* from touter join thash use index(idx_b) on touter.b = thash.b`).Sort().Check( tk.MustQuery(`select /*+ INL_JOIN(touter, tnormal) */ tnormal.* from touter join tnormal use index(idx_b) on touter.b = tnormal.b`).Sort().Rows()) } @@ -2150,11 +2150,11 @@ func TestParallelApply(t *testing.T) { `└─Apply 10000.00 root CARTESIAN inner join, other cond:gt(cast(test_parallel_apply.touter.a, decimal(10,0) BINARY), Column#7)`, ` ├─TableReader(Build) 10000.00 root data:TableFullScan`, ` │ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`, - ` └─StreamAgg(Probe) 1.00 root funcs:sum(Column#9)->Column#7`, - ` └─IndexReader 1.00 root partition:all index:StreamAgg`, // IndexReader is a inner child of Apply - ` └─StreamAgg 1.00 cop[tikv] funcs:sum(test_parallel_apply.thash.a)->Column#9`, - ` └─Selection 8000.00 cop[tikv] gt(test_parallel_apply.thash.a, test_parallel_apply.touter.b)`, - ` └─IndexFullScan 10000.00 cop[tikv] table:thash, index:a(a) keep order:false, stats:pseudo`)) + ` └─StreamAgg(Probe) 10000.00 root funcs:sum(Column#9)->Column#7`, + ` └─IndexReader 10000.00 root partition:all index:StreamAgg`, // IndexReader is a inner child of Apply + ` └─StreamAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.thash.a)->Column#9`, + ` └─Selection 80000000.00 cop[tikv] gt(test_parallel_apply.thash.a, test_parallel_apply.touter.b)`, + ` └─IndexFullScan 100000000.00 cop[tikv] table:thash, index:a(a) keep order:false, stats:pseudo`)) tk.MustQuery(`select * from touter where touter.a > (select sum(thash.a) from thash use index(a) where thash.a>touter.b)`).Sort().Check( tk.MustQuery(`select * from touter where touter.a > (select sum(tinner.a) from tinner use index(a) where tinner.a>touter.b)`).Sort().Rows()) @@ -2164,11 +2164,11 @@ func TestParallelApply(t *testing.T) { `└─Apply 10000.00 root CARTESIAN inner join, other cond:gt(cast(test_parallel_apply.touter.a, decimal(10,0) BINARY), Column#7)`, ` ├─TableReader(Build) 10000.00 root data:TableFullScan`, ` │ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`, - ` └─StreamAgg(Probe) 1.00 root funcs:sum(Column#9)->Column#7`, - ` └─TableReader 1.00 root partition:all data:StreamAgg`, // TableReader is a inner child of Apply - ` └─StreamAgg 1.00 cop[tikv] funcs:sum(test_parallel_apply.thash.b)->Column#9`, - ` └─Selection 8000.00 cop[tikv] gt(test_parallel_apply.thash.a, test_parallel_apply.touter.b)`, - ` └─TableFullScan 10000.00 cop[tikv] table:thash keep order:false, stats:pseudo`)) + ` └─StreamAgg(Probe) 10000.00 root funcs:sum(Column#9)->Column#7`, + ` └─TableReader 10000.00 root partition:all data:StreamAgg`, // TableReader is a inner child of Apply + ` └─StreamAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.thash.b)->Column#9`, + ` └─Selection 80000000.00 cop[tikv] gt(test_parallel_apply.thash.a, test_parallel_apply.touter.b)`, + ` └─TableFullScan 100000000.00 cop[tikv] table:thash keep order:false, stats:pseudo`)) tk.MustQuery(`select * from touter where touter.a > (select sum(thash.b) from thash ignore index(a) where thash.a>touter.b)`).Sort().Check( tk.MustQuery(`select * from touter where touter.a > (select sum(tinner.b) from tinner ignore index(a) where tinner.a>touter.b)`).Sort().Rows()) @@ -2178,12 +2178,12 @@ func TestParallelApply(t *testing.T) { `└─Apply 10000.00 root CARTESIAN inner join, other cond:gt(cast(test_parallel_apply.touter.a, decimal(10,0) BINARY), Column#7)`, ` ├─TableReader(Build) 10000.00 root data:TableFullScan`, ` │ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`, - ` └─HashAgg(Probe) 1.00 root funcs:sum(Column#9)->Column#7`, - ` └─IndexLookUp 1.00 root `, // IndexLookUp is a inner child of Apply - ` ├─Selection(Build) 8000.00 cop[tikv] gt(test_parallel_apply.tinner.a, test_parallel_apply.touter.b)`, - ` │ └─IndexFullScan 10000.00 cop[tikv] table:tinner, index:a(a) keep order:false, stats:pseudo`, - ` └─HashAgg(Probe) 1.00 cop[tikv] funcs:sum(test_parallel_apply.tinner.b)->Column#9`, - ` └─TableRowIDScan 8000.00 cop[tikv] table:tinner keep order:false, stats:pseudo`)) + ` └─HashAgg(Probe) 10000.00 root funcs:sum(Column#9)->Column#7`, + ` └─IndexLookUp 10000.00 root `, // IndexLookUp is a inner child of Apply + ` ├─Selection(Build) 80000000.00 cop[tikv] gt(test_parallel_apply.tinner.a, test_parallel_apply.touter.b)`, + ` │ └─IndexFullScan 100000000.00 cop[tikv] table:tinner, index:a(a) keep order:false, stats:pseudo`, + ` └─HashAgg(Probe) 10000.00 cop[tikv] funcs:sum(test_parallel_apply.tinner.b)->Column#9`, + ` └─TableRowIDScan 80000000.00 cop[tikv] table:tinner keep order:false, stats:pseudo`)) tk.MustQuery(`select * from touter where touter.a > (select sum(thash.b) from thash use index(a) where thash.a>touter.b)`).Sort().Check( tk.MustQuery(`select * from touter where touter.a > (select sum(tinner.b) from tinner use index(a) where tinner.a>touter.b)`).Sort().Rows()) @@ -2193,11 +2193,11 @@ func TestParallelApply(t *testing.T) { `└─Apply 10000.00 root CARTESIAN inner join, other cond:gt(cast(test_parallel_apply.touter.a, decimal(10,0) BINARY), Column#7)`, ` ├─TableReader(Build) 10000.00 root data:TableFullScan`, ` │ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`, - ` └─StreamAgg(Probe) 1.00 root funcs:sum(Column#9)->Column#7`, - ` └─IndexReader 1.00 root partition:all index:StreamAgg`, // IndexReader is a inner child of Apply - ` └─StreamAgg 1.00 cop[tikv] funcs:sum(test_parallel_apply.trange.a)->Column#9`, - ` └─Selection 8000.00 cop[tikv] gt(test_parallel_apply.trange.a, test_parallel_apply.touter.b)`, - ` └─IndexFullScan 10000.00 cop[tikv] table:trange, index:a(a) keep order:false, stats:pseudo`)) + ` └─StreamAgg(Probe) 10000.00 root funcs:sum(Column#9)->Column#7`, + ` └─IndexReader 10000.00 root partition:all index:StreamAgg`, // IndexReader is a inner child of Apply + ` └─StreamAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.trange.a)->Column#9`, + ` └─Selection 80000000.00 cop[tikv] gt(test_parallel_apply.trange.a, test_parallel_apply.touter.b)`, + ` └─IndexFullScan 100000000.00 cop[tikv] table:trange, index:a(a) keep order:false, stats:pseudo`)) tk.MustQuery(`select * from touter where touter.a > (select sum(trange.a) from trange use index(a) where trange.a>touter.b)`).Sort().Check( tk.MustQuery(`select * from touter where touter.a > (select sum(tinner.a) from tinner use index(a) where tinner.a>touter.b)`).Sort().Rows()) @@ -2207,11 +2207,11 @@ func TestParallelApply(t *testing.T) { `└─Apply 10000.00 root CARTESIAN inner join, other cond:gt(cast(test_parallel_apply.touter.a, decimal(10,0) BINARY), Column#7)`, ` ├─TableReader(Build) 10000.00 root data:TableFullScan`, ` │ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`, - ` └─StreamAgg(Probe) 1.00 root funcs:sum(Column#9)->Column#7`, - ` └─TableReader 1.00 root partition:all data:StreamAgg`, // TableReader is a inner child of Apply - ` └─StreamAgg 1.00 cop[tikv] funcs:sum(test_parallel_apply.trange.b)->Column#9`, - ` └─Selection 8000.00 cop[tikv] gt(test_parallel_apply.trange.a, test_parallel_apply.touter.b)`, - ` └─TableFullScan 10000.00 cop[tikv] table:trange keep order:false, stats:pseudo`)) + ` └─StreamAgg(Probe) 10000.00 root funcs:sum(Column#9)->Column#7`, + ` └─TableReader 10000.00 root partition:all data:StreamAgg`, // TableReader is a inner child of Apply + ` └─StreamAgg 10000.00 cop[tikv] funcs:sum(test_parallel_apply.trange.b)->Column#9`, + ` └─Selection 80000000.00 cop[tikv] gt(test_parallel_apply.trange.a, test_parallel_apply.touter.b)`, + ` └─TableFullScan 100000000.00 cop[tikv] table:trange keep order:false, stats:pseudo`)) tk.MustQuery(`select * from touter where touter.a > (select sum(trange.b) from trange ignore index(a) where trange.a>touter.b)`).Sort().Check( tk.MustQuery(`select * from touter where touter.a > (select sum(tinner.b) from tinner ignore index(a) where tinner.a>touter.b)`).Sort().Rows()) @@ -2221,12 +2221,12 @@ func TestParallelApply(t *testing.T) { `└─Apply 10000.00 root CARTESIAN inner join, other cond:gt(cast(test_parallel_apply.touter.a, decimal(10,0) BINARY), Column#7)`, ` ├─TableReader(Build) 10000.00 root data:TableFullScan`, ` │ └─TableFullScan 10000.00 cop[tikv] table:touter keep order:false, stats:pseudo`, - ` └─HashAgg(Probe) 1.00 root funcs:sum(Column#9)->Column#7`, - ` └─IndexLookUp 1.00 root `, // IndexLookUp is a inner child of Apply - ` ├─Selection(Build) 8000.00 cop[tikv] gt(test_parallel_apply.tinner.a, test_parallel_apply.touter.b)`, - ` │ └─IndexFullScan 10000.00 cop[tikv] table:tinner, index:a(a) keep order:false, stats:pseudo`, - ` └─HashAgg(Probe) 1.00 cop[tikv] funcs:sum(test_parallel_apply.tinner.b)->Column#9`, - ` └─TableRowIDScan 8000.00 cop[tikv] table:tinner keep order:false, stats:pseudo`)) + ` └─HashAgg(Probe) 10000.00 root funcs:sum(Column#9)->Column#7`, + ` └─IndexLookUp 10000.00 root `, // IndexLookUp is a inner child of Apply + ` ├─Selection(Build) 80000000.00 cop[tikv] gt(test_parallel_apply.tinner.a, test_parallel_apply.touter.b)`, + ` │ └─IndexFullScan 100000000.00 cop[tikv] table:tinner, index:a(a) keep order:false, stats:pseudo`, + ` └─HashAgg(Probe) 10000.00 cop[tikv] funcs:sum(test_parallel_apply.tinner.b)->Column#9`, + ` └─TableRowIDScan 80000000.00 cop[tikv] table:tinner keep order:false, stats:pseudo`)) tk.MustQuery(`select * from touter where touter.a > (select sum(trange.b) from trange use index(a) where trange.a>touter.b)`).Sort().Check( tk.MustQuery(`select * from touter where touter.a > (select sum(tinner.b) from tinner use index(a) where tinner.a>touter.b)`).Sort().Rows()) diff --git a/executor/prepared_test.go b/executor/prepared_test.go index f5629a41e9297..2b8b98c246267 100644 --- a/executor/prepared_test.go +++ b/executor/prepared_test.go @@ -909,10 +909,10 @@ func TestIssue29101(t *testing.T) { ` │ └─IndexLookUp_29 0.03 root `, ` │ ├─IndexRangeScan_27(Build) 0.03 cop[tikv] table:order_line, index:PRIMARY(ol_w_id, ol_d_id, ol_o_id, ol_number) range:[391 1 3038,391 1 3058), keep order:false, stats:pseudo`, ` │ └─TableRowIDScan_28(Probe) 0.03 cop[tikv] table:order_line keep order:false, stats:pseudo`, - ` └─IndexLookUp_13(Probe) 1.00 root `, - ` ├─IndexRangeScan_10(Build) 1.00 cop[tikv] table:stock, index:PRIMARY(s_w_id, s_i_id) range: decided by [eq(test.stock.s_i_id, test.order_line.ol_i_id) eq(test.stock.s_w_id, 391)], keep order:false, stats:pseudo`, - ` └─Selection_12(Probe) 1.00 cop[tikv] lt(test.stock.s_quantity, 18)`, - ` └─TableRowIDScan_11 1.00 cop[tikv] table:stock keep order:false, stats:pseudo`)) + ` └─IndexLookUp_13(Probe) 0.03 root `, + ` ├─IndexRangeScan_10(Build) 0.03 cop[tikv] table:stock, index:PRIMARY(s_w_id, s_i_id) range: decided by [eq(test.stock.s_i_id, test.order_line.ol_i_id) eq(test.stock.s_w_id, 391)], keep order:false, stats:pseudo`, + ` └─Selection_12(Probe) 0.03 cop[tikv] lt(test.stock.s_quantity, 18)`, + ` └─TableRowIDScan_11 0.03 cop[tikv] table:stock keep order:false, stats:pseudo`)) tk.MustExec(`execute s1 using @a,@b,@c,@c,@a,@d`) tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("1")) // can use the plan-cache } diff --git a/planner/core/common_plans.go b/planner/core/common_plans.go index 7816b9deaec02..fc0739fc46ba9 100644 --- a/planner/core/common_plans.go +++ b/planner/core/common_plans.go @@ -896,13 +896,13 @@ func (e *Explain) getOperatorInfo(p Plan, id string) (string, string, string, st return row[1], "N/A", "N/A", row[3], row[4] } } + + pp, isPhysicalPlan := p.(PhysicalPlan) estRows := "N/A" - if si := p.statsInfo(); si != nil { - estRows = strconv.FormatFloat(si.RowCount, 'f', 2, 64) - } estCost := "N/A" costFormula := "N/A" - if pp, ok := p.(PhysicalPlan); ok { + if isPhysicalPlan { + estRows = strconv.FormatFloat(pp.getEstRowCountForDisplay(), 'f', 2, 64) if e.ctx != nil && e.ctx.GetSessionVars().CostModelVersion == modelVer2 { costVer2, _ := pp.getPlanCostVer2(property.RootTaskType, NewDefaultPlanCostOption()) estCost = strconv.FormatFloat(costVer2.cost, 'f', 2, 64) @@ -911,7 +911,10 @@ func (e *Explain) getOperatorInfo(p Plan, id string) (string, string, string, st planCost, _ := getPlanCost(pp, property.RootTaskType, NewDefaultPlanCostOption()) estCost = strconv.FormatFloat(planCost, 'f', 2, 64) } + } else if si := p.statsInfo(); si != nil { + estRows = strconv.FormatFloat(si.RowCount, 'f', 2, 64) } + var accessObject, operatorInfo string if plan, ok := p.(dataAccesser); ok { accessObject = plan.AccessObject().String() @@ -1008,15 +1011,16 @@ func binaryOpFromFlatOp(explainCtx sessionctx.Context, op *FlatOperator, out *ti } } - // Runtime info - rootStats, copStats, memTracker, diskTracker := getRuntimeInfo(explainCtx, op.Origin, nil) - if statsInfo := op.Origin.statsInfo(); statsInfo != nil { - out.EstRows = statsInfo.RowCount - } if op.IsPhysicalPlan { p := op.Origin.(PhysicalPlan) out.Cost, _ = getPlanCost(p, property.RootTaskType, NewDefaultPlanCostOption()) + out.EstRows = p.getEstRowCountForDisplay() + } else if statsInfo := op.Origin.statsInfo(); statsInfo != nil { + out.EstRows = statsInfo.RowCount } + + // Runtime info + rootStats, copStats, memTracker, diskTracker := getRuntimeInfo(explainCtx, op.Origin, nil) if rootStats != nil { basic, groups := rootStats.MergeStats() out.RootBasicExecInfo = basic.String() diff --git a/planner/core/encode.go b/planner/core/encode.go index 686e6ef965475..4345c80c39fc1 100644 --- a/planner/core/encode.go +++ b/planner/core/encode.go @@ -69,7 +69,9 @@ func EncodeFlatPlan(flat *FlatPhysicalPlan) string { p := op.Origin actRows, analyzeInfo, memoryInfo, diskInfo := getRuntimeInfoStr(p.SCtx(), p, nil) var estRows float64 - if statsInfo := p.statsInfo(); statsInfo != nil { + if op.IsPhysicalPlan { + estRows = op.Origin.(PhysicalPlan).getEstRowCountForDisplay() + } else if statsInfo := p.statsInfo(); statsInfo != nil { estRows = statsInfo.RowCount } plancodec.EncodePlanNode( @@ -98,7 +100,9 @@ func encodeFlatPlanTree(flatTree FlatPlanTree, offset int, buf *bytes.Buffer) { p := op.Origin actRows, analyzeInfo, memoryInfo, diskInfo := getRuntimeInfoStr(p.SCtx(), p, nil) var estRows float64 - if statsInfo := p.statsInfo(); statsInfo != nil { + if op.IsPhysicalPlan { + estRows = op.Origin.(PhysicalPlan).getEstRowCountForDisplay() + } else if statsInfo := p.statsInfo(); statsInfo != nil { estRows = statsInfo.RowCount } plancodec.EncodePlanNode( @@ -199,8 +203,10 @@ func (pn *planEncoder) encodePlan(p Plan, isRoot bool, store kv.StoreType, depth taskTypeInfo := plancodec.EncodeTaskType(isRoot, store) actRows, analyzeInfo, memoryInfo, diskInfo := getRuntimeInfoStr(p.SCtx(), p, nil) rowCount := 0.0 - if statsInfo := p.statsInfo(); statsInfo != nil { - rowCount = p.statsInfo().RowCount + if pp, ok := p.(PhysicalPlan); ok { + rowCount = pp.getEstRowCountForDisplay() + } else if statsInfo := p.statsInfo(); statsInfo != nil { + rowCount = statsInfo.RowCount } plancodec.EncodePlanNode(depth, strconv.Itoa(p.ID()), p.TP(), rowCount, taskTypeInfo, p.ExplainInfo(), actRows, analyzeInfo, memoryInfo, diskInfo, &pn.buf) pn.encodedPlans[p.ID()] = true diff --git a/planner/core/flat_plan.go b/planner/core/flat_plan.go index 3058f0fd82e92..ed283ee7ece93 100644 --- a/planner/core/flat_plan.go +++ b/planner/core/flat_plan.go @@ -339,7 +339,11 @@ func (f *FlatPhysicalPlan) flattenRecursively(p Plan, info *operatorCtx, target target, childIdx = f.flattenRecursively(plan.DataSource, childCtx, target) childIdxs = append(childIdxs, childIdx) case *PhysicalCTE: - f.ctesToFlatten = append(f.ctesToFlatten, plan) + // We shallow copy the PhysicalCTE here because we don't want the probeParents (see comments in PhysicalPlan + // for details) to affect the row count display of the independent CTE plan tree. + copiedCTE := *plan + copiedCTE.probeParents = nil + f.ctesToFlatten = append(f.ctesToFlatten, &copiedCTE) case *Insert: if plan.SelectPlan != nil { childCtx.isRoot = true diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index e716561b114e1..911bedace451e 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -5553,42 +5553,42 @@ func TestIndexJoinCost(t *testing.T) { `├─TableReader_18(Build) 9990.00 36412.58 root data:Selection_17`, `│ └─Selection_17 9990.00 465000.00 cop[tikv] not(isnull(test.t_outer.a))`, `│ └─TableFullScan_16 10000.00 435000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`, - `└─TableReader_8(Probe) 1.00 3.88 root data:TableRangeScan_7`, - ` └─TableRangeScan_7 1.00 30.00 cop[tikv] table:t_inner_pk range: decided by [test.t_outer.a], keep order:false, stats:pseudo`)) + `└─TableReader_8(Probe) 9990.00 3.88 root data:TableRangeScan_7`, + ` └─TableRangeScan_7 9990.00 30.00 cop[tikv] table:t_inner_pk range: decided by [test.t_outer.a], keep order:false, stats:pseudo`)) tk.MustQuery(`explain format=verbose select /*+ TIDB_INLJ(t_outer, t_inner_idx) */ t_inner_idx.a from t_outer, t_inner_idx where t_outer.a=t_inner_idx.a`).Check(testkit.Rows( // IndexJoin with inner IndexScan `IndexJoin_10 12487.50 235192.19 root inner join, inner:IndexReader_9, outer key:test.t_outer.a, inner key:test.t_inner_idx.a, equal cond:eq(test.t_outer.a, test.t_inner_idx.a)`, `├─TableReader_20(Build) 9990.00 36412.58 root data:Selection_19`, `│ └─Selection_19 9990.00 465000.00 cop[tikv] not(isnull(test.t_outer.a))`, `│ └─TableFullScan_18 10000.00 435000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`, - `└─IndexReader_9(Probe) 1.25 5.89 root index:Selection_8`, - ` └─Selection_8 1.25 58.18 cop[tikv] not(isnull(test.t_inner_idx.a))`, - ` └─IndexRangeScan_7 1.25 54.43 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`)) + `└─IndexReader_9(Probe) 12487.50 5.89 root index:Selection_8`, + ` └─Selection_8 12487.50 58.18 cop[tikv] not(isnull(test.t_inner_idx.a))`, + ` └─IndexRangeScan_7 12500.00 54.43 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`)) tk.MustQuery(`explain format=verbose select /*+ TIDB_INLJ(t_outer, t_inner_idx) */ * from t_outer, t_inner_idx where t_outer.a=t_inner_idx.a`).Check(testkit.Rows( // IndexJoin with inner IndexLookup `IndexJoin_11 12487.50 531469.38 root inner join, inner:IndexLookUp_10, outer key:test.t_outer.a, inner key:test.t_inner_idx.a, equal cond:eq(test.t_outer.a, test.t_inner_idx.a)`, `├─TableReader_23(Build) 9990.00 36412.58 root data:Selection_22`, `│ └─Selection_22 9990.00 465000.00 cop[tikv] not(isnull(test.t_outer.a))`, `│ └─TableFullScan_21 10000.00 435000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`, - `└─IndexLookUp_10(Probe) 1.25 35.55 root `, - ` ├─Selection_9(Build) 1.25 75.08 cop[tikv] not(isnull(test.t_inner_idx.a))`, - ` │ └─IndexRangeScan_7 1.25 71.32 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`, - ` └─TableRowIDScan_8(Probe) 1.25 71.25 cop[tikv] table:t_inner_idx keep order:false, stats:pseudo`)) + `└─IndexLookUp_10(Probe) 12487.50 35.55 root `, + ` ├─Selection_9(Build) 12487.50 75.08 cop[tikv] not(isnull(test.t_inner_idx.a))`, + ` │ └─IndexRangeScan_7 12500.00 71.32 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`, + ` └─TableRowIDScan_8(Probe) 12487.50 71.25 cop[tikv] table:t_inner_idx keep order:false, stats:pseudo`)) tk.MustQuery("explain format=verbose select /*+ inl_hash_join(t_outer, t_inner_idx) */ t_inner_idx.a from t_outer, t_inner_idx where t_outer.a=t_inner_idx.a").Check(testkit.Rows( `IndexHashJoin_12 12487.50 235192.19 root inner join, inner:IndexReader_9, outer key:test.t_outer.a, inner key:test.t_inner_idx.a, equal cond:eq(test.t_outer.a, test.t_inner_idx.a)`, `├─TableReader_20(Build) 9990.00 36412.58 root data:Selection_19`, `│ └─Selection_19 9990.00 465000.00 cop[tikv] not(isnull(test.t_outer.a))`, `│ └─TableFullScan_18 10000.00 435000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`, - `└─IndexReader_9(Probe) 1.25 5.89 root index:Selection_8`, - ` └─Selection_8 1.25 58.18 cop[tikv] not(isnull(test.t_inner_idx.a))`, - ` └─IndexRangeScan_7 1.25 54.43 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`)) + `└─IndexReader_9(Probe) 12487.50 5.89 root index:Selection_8`, + ` └─Selection_8 12487.50 58.18 cop[tikv] not(isnull(test.t_inner_idx.a))`, + ` └─IndexRangeScan_7 12500.00 54.43 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:false, stats:pseudo`)) tk.MustQuery("explain format=verbose select /*+ inl_merge_join(t_outer, t_inner_idx) */ t_inner_idx.a from t_outer, t_inner_idx where t_outer.a=t_inner_idx.a").Check(testkit.Rows( `IndexMergeJoin_17 12487.50 229210.68 root inner join, inner:IndexReader_15, outer key:test.t_outer.a, inner key:test.t_inner_idx.a`, `├─TableReader_20(Build) 9990.00 36412.58 root data:Selection_19`, `│ └─Selection_19 9990.00 465000.00 cop[tikv] not(isnull(test.t_outer.a))`, `│ └─TableFullScan_18 10000.00 435000.00 cop[tikv] table:t_outer keep order:false, stats:pseudo`, - `└─IndexReader_15(Probe) 1.25 5.89 root index:Selection_14`, - ` └─Selection_14 1.25 58.18 cop[tikv] not(isnull(test.t_inner_idx.a))`, - ` └─IndexRangeScan_13 1.25 54.43 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:true, stats:pseudo`)) + `└─IndexReader_15(Probe) 12487.50 5.89 root index:Selection_14`, + ` └─Selection_14 12487.50 58.18 cop[tikv] not(isnull(test.t_inner_idx.a))`, + ` └─IndexRangeScan_13 12500.00 54.43 cop[tikv] table:t_inner_idx, index:a(a) range: decided by [eq(test.t_inner_idx.a, test.t_outer.a)], keep order:true, stats:pseudo`)) } func TestHeuristicIndexSelection(t *testing.T) { @@ -6859,10 +6859,10 @@ func TestIssue29663(t *testing.T) { " └─Apply_20 10000.00 root CARTESIAN left outer join", " ├─TableReader_22(Build) 10000.00 root data:TableFullScan_21", " │ └─TableFullScan_21 10000.00 cop[tikv] table:one keep order:false, stats:pseudo", - " └─MaxOneRow_23(Probe) 1.00 root ", - " └─TableReader_26 2.00 root data:Selection_25", - " └─Selection_25 2.00 cop[tikv] eq(test.t2.c, test.t1.b)", - " └─TableFullScan_24 2000.00 cop[tikv] table:two keep order:false, stats:pseudo")) + " └─MaxOneRow_23(Probe) 10000.00 root ", + " └─TableReader_26 20000.00 root data:Selection_25", + " └─Selection_25 20000.00 cop[tikv] eq(test.t2.c, test.t1.b)", + " └─TableFullScan_24 20000000.00 cop[tikv] table:two keep order:false, stats:pseudo")) } func TestIssue31609(t *testing.T) { diff --git a/planner/core/optimizer.go b/planner/core/optimizer.go index 09c370dd11f60..4623af7261104 100644 --- a/planner/core/optimizer.go +++ b/planner/core/optimizer.go @@ -382,6 +382,7 @@ func postOptimize(sctx sessionctx.Context, plan PhysicalPlan) PhysicalPlan { plan = enableParallelApply(sctx, plan) handleFineGrainedShuffle(sctx, plan) checkPlanCacheable(sctx, plan) + propagateProbeParents(plan, nil) return plan } @@ -523,6 +524,42 @@ func checkPlanCacheable(sctx sessionctx.Context, plan PhysicalPlan) { } } +// propagateProbeParents doesn't affect the execution plan, it only sets the probeParents field of a PhysicalPlan. +// It's for handling the inconsistency between row count in the statsInfo and the recorded actual row count. Please +// see comments in PhysicalPlan for details. +func propagateProbeParents(plan PhysicalPlan, probeParents []PhysicalPlan) { + plan.setProbeParents(probeParents) + switch x := plan.(type) { + case *PhysicalApply, *PhysicalIndexJoin, *PhysicalIndexHashJoin, *PhysicalIndexMergeJoin: + if join, ok := plan.(interface{ getInnerChildIdx() int }); ok { + propagateProbeParents(plan.Children()[1-join.getInnerChildIdx()], probeParents) + + // The core logic of this method: + // Record every Apply and Index Join we met, record it in a slice, and set it in their inner children. + newParents := make([]PhysicalPlan, len(probeParents), len(probeParents)+1) + copy(newParents, probeParents) + newParents = append(newParents, plan) + propagateProbeParents(plan.Children()[join.getInnerChildIdx()], newParents) + } + case *PhysicalTableReader: + propagateProbeParents(x.tablePlan, probeParents) + case *PhysicalIndexReader: + propagateProbeParents(x.indexPlan, probeParents) + case *PhysicalIndexLookUpReader: + propagateProbeParents(x.indexPlan, probeParents) + propagateProbeParents(x.tablePlan, probeParents) + case *PhysicalIndexMergeReader: + for _, pchild := range x.partialPlans { + propagateProbeParents(pchild, probeParents) + } + propagateProbeParents(x.tablePlan, probeParents) + default: + for _, child := range plan.Children() { + propagateProbeParents(child, probeParents) + } + } +} + // useTiFlash used to check whether the plan use the TiFlash engine. func useTiFlash(p PhysicalPlan) bool { switch x := p.(type) { diff --git a/planner/core/physical_plans.go b/planner/core/physical_plans.go index 54180e2ce58fe..56650b357f30f 100644 --- a/planner/core/physical_plans.go +++ b/planner/core/physical_plans.go @@ -1135,6 +1135,10 @@ type basePhysicalJoin struct { RightNAJoinKeys []*expression.Column } +func (p *basePhysicalJoin) getInnerChildIdx() int { + return p.InnerChildIdx +} + func (p *basePhysicalJoin) cloneWithSelf(newSelf PhysicalPlan) (*basePhysicalJoin, error) { cloned := new(basePhysicalJoin) base, err := p.physicalSchemaProducer.cloneWithSelf(newSelf) diff --git a/planner/core/plan.go b/planner/core/plan.go index 03e7a0fafa43f..912f3887f104c 100644 --- a/planner/core/plan.go +++ b/planner/core/plan.go @@ -28,6 +28,7 @@ import ( "github.com/pingcap/tidb/planner/util" "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" + "github.com/pingcap/tidb/util/execdetails" "github.com/pingcap/tidb/util/mathutil" "github.com/pingcap/tidb/util/size" "github.com/pingcap/tidb/util/stringutil" @@ -379,6 +380,26 @@ type PhysicalPlan interface { // MemoryUsage return the memory usage of PhysicalPlan MemoryUsage() int64 + + // Below three methods help to handle the inconsistency between row count in the statsInfo and the recorded + // actual row count. + // For the children in the inner side (probe side) of Index Join and Apply, the row count in the statsInfo + // means the estimated row count for a single "probe", but the recorded actual row count is the total row + // count for all "probes". + // To handle this inconsistency without breaking anything else, we added a field `probeParents` of + // type `[]PhysicalPlan` into all PhysicalPlan to record all operators that are (indirect or direct) parents + // of this PhysicalPlan and will cause this inconsistency. + // Using this information, we can convert the row count between the "single probe" row count and "all probes" + // row count freely. + + // setProbeParents sets the above stated `probeParents` field. + setProbeParents([]PhysicalPlan) + // getEstRowCountForDisplay uses the "single probe" row count in statsInfo and the probeParents to calculate + // the "all probe" row count. + // All places that display the row count for a PhysicalPlan are expected to use this method. + getEstRowCountForDisplay() float64 + // getEstRowCountForDisplay uses the runtime stats and the probeParents to calculate the actual "probe" count. + getActualProbeCnt(*execdetails.RuntimeStatsColl) int64 } // NewDefaultPlanCostOption returns PlanCostOption @@ -449,6 +470,42 @@ func (*baseLogicalPlan) ExplainInfo() string { return "" } +func getEstimatedProbeCntFromProbeParents(probeParents []PhysicalPlan) float64 { + res := float64(1) + for _, pp := range probeParents { + switch pp.(type) { + case *PhysicalApply, *PhysicalIndexHashJoin, *PhysicalIndexMergeJoin, *PhysicalIndexJoin: + if join, ok := pp.(interface{ getInnerChildIdx() int }); ok { + outer := pp.Children()[1-join.getInnerChildIdx()] + res *= outer.statsInfo().RowCount + } + } + } + return res +} + +func getActualProbeCntFromProbeParents(pps []PhysicalPlan, statsColl *execdetails.RuntimeStatsColl) int64 { + res := int64(1) + for _, pp := range pps { + switch pp.(type) { + case *PhysicalApply, *PhysicalIndexHashJoin, *PhysicalIndexMergeJoin, *PhysicalIndexJoin: + if join, ok := pp.(interface{ getInnerChildIdx() int }); ok { + outerChildID := pp.Children()[1-join.getInnerChildIdx()].ID() + actRows := int64(1) + if statsColl.ExistsRootStats(outerChildID) { + actRows = statsColl.GetRootStats(outerChildID).GetActRows() + } + if statsColl.ExistsCopStats(outerChildID) { + actRows = statsColl.GetCopStats(outerChildID).GetActRows() + } + // TODO: For PhysicalApply, we need to consider cache hit ratio in JoinRuntimeStats and use actRows/(1-ratio) here. + res *= actRows + } + } + } + return res +} + type basePhysicalPlan struct { basePlan @@ -461,6 +518,10 @@ type basePhysicalPlan struct { planCost float64 planCostVer2 costVer2 + // probeParents records the IndexJoins and Applys with this operator in their inner children. + // Please see comments in PhysicalPlan for details. + probeParents []PhysicalPlan + // Only for MPP. If TiFlashFineGrainedShuffleStreamCount > 0: // 1. For ExchangeSender, means its output will be partitioned by hash key. // 2. For ExchangeReceiver/Window/Sort, means its input is already partitioned. @@ -472,6 +533,7 @@ func (p *basePhysicalPlan) cloneWithSelf(newSelf PhysicalPlan) (*basePhysicalPla basePlan: p.basePlan, self: newSelf, TiFlashFineGrainedShuffleStreamCount: p.TiFlashFineGrainedShuffleStreamCount, + probeParents: p.probeParents, } for _, child := range p.children { cloned, err := child.Clone() @@ -535,6 +597,24 @@ func (p *basePhysicalPlan) MemoryUsage() (sum int64) { return } +func (p *basePhysicalPlan) getEstRowCountForDisplay() float64 { + if p == nil { + return 0 + } + return p.statsInfo().RowCount * getEstimatedProbeCntFromProbeParents(p.probeParents) +} + +func (p *basePhysicalPlan) getActualProbeCnt(statsColl *execdetails.RuntimeStatsColl) int64 { + if p == nil { + return 1 + } + return getActualProbeCntFromProbeParents(p.probeParents, statsColl) +} + +func (p *basePhysicalPlan) setProbeParents(probeParents []PhysicalPlan) { + p.probeParents = probeParents +} + // GetLogicalTS4TaskMap get the logical TimeStamp now to help rollback the TaskMap changes after that. func (p *baseLogicalPlan) GetLogicalTS4TaskMap() uint64 { p.ctx.GetSessionVars().StmtCtx.TaskMapBakTS++ diff --git a/planner/core/plan_cost_ver1.go b/planner/core/plan_cost_ver1.go index 0d78c0dde8fdf..65542c3b3fdcf 100644 --- a/planner/core/plan_cost_ver1.go +++ b/planner/core/plan_cost_ver1.go @@ -1269,7 +1269,8 @@ func getOperatorActRows(operator PhysicalPlan) float64 { func getCardinality(operator PhysicalPlan, costFlag uint64) float64 { if hasCostFlag(costFlag, CostFlagUseTrueCardinality) { - return getOperatorActRows(operator) + actualProbeCnt := operator.getActualProbeCnt(operator.SCtx().GetSessionVars().StmtCtx.RuntimeStatsColl) + return getOperatorActRows(operator) / float64(actualProbeCnt) } return operator.StatsCount() } diff --git a/planner/core/point_get_plan.go b/planner/core/point_get_plan.go index 96e17291e421c..4c09e82d746ab 100644 --- a/planner/core/point_get_plan.go +++ b/planner/core/point_get_plan.go @@ -44,6 +44,7 @@ import ( tidbutil "github.com/pingcap/tidb/util" "github.com/pingcap/tidb/util/chunk" "github.com/pingcap/tidb/util/collate" + "github.com/pingcap/tidb/util/execdetails" "github.com/pingcap/tidb/util/logutil" "github.com/pingcap/tidb/util/mathutil" "github.com/pingcap/tidb/util/plancodec" @@ -90,6 +91,28 @@ type PointGetPlan struct { planCostVer2 costVer2 // accessCols represents actual columns the PointGet will access, which are used to calculate row-size accessCols []*expression.Column + + // probeParents records the IndexJoins and Applys with this operator in their inner children. + // Please see comments in PhysicalPlan for details. + probeParents []PhysicalPlan +} + +func (p *PointGetPlan) getEstRowCountForDisplay() float64 { + if p == nil { + return 0 + } + return p.statsInfo().RowCount * getEstimatedProbeCntFromProbeParents(p.probeParents) +} + +func (p *PointGetPlan) getActualProbeCnt(statsColl *execdetails.RuntimeStatsColl) int64 { + if p == nil { + return 1 + } + return getActualProbeCntFromProbeParents(p.probeParents, statsColl) +} + +func (p *PointGetPlan) setProbeParents(probeParents []PhysicalPlan) { + p.probeParents = probeParents } type nameValuePair struct { @@ -317,6 +340,27 @@ type BatchPointGetPlan struct { planCostVer2 costVer2 // accessCols represents actual columns the PointGet will access, which are used to calculate row-size accessCols []*expression.Column + + // probeParents records the IndexJoins and Applys with this operator in their inner children. + // Please see comments in PhysicalPlan for details. + probeParents []PhysicalPlan +} + +func (p *BatchPointGetPlan) getEstRowCountForDisplay() float64 { + if p == nil { + return 0 + } + return p.statsInfo().RowCount * getEstimatedProbeCntFromProbeParents(p.probeParents) +} + +func (p *BatchPointGetPlan) getActualProbeCnt(statsColl *execdetails.RuntimeStatsColl) int64 { + if p == nil { + return 1 + } + return getActualProbeCntFromProbeParents(p.probeParents, statsColl) +} +func (p *BatchPointGetPlan) setProbeParents(probeParents []PhysicalPlan) { + p.probeParents = probeParents } // Cost implements PhysicalPlan interface diff --git a/planner/core/testdata/analyze_suite_out.json b/planner/core/testdata/analyze_suite_out.json index 74d7201f50c06..e1fbcba55ee34 100644 --- a/planner/core/testdata/analyze_suite_out.json +++ b/planner/core/testdata/analyze_suite_out.json @@ -259,9 +259,9 @@ "├─TableReader(Build) 9980.01 root data:Selection", "│ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.c))", "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─IndexReader(Probe) 1.25 root index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.c))", - " └─IndexRangeScan 1.25 cop[tikv] table:t2, index:idx(a, b, c) range: decided by [eq(test.t2.a, test.t1.a) gt(test.t2.b, minus(test.t1.b, 1)) lt(test.t2.b, plus(test.t1.b, 1))], keep order:false, stats:pseudo" + "└─IndexReader(Probe) 12475.01 root index:Selection", + " └─Selection 12475.01 cop[tikv] not(isnull(test.t2.a)), not(isnull(test.t2.c))", + " └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:idx(a, b, c) range: decided by [eq(test.t2.a, test.t1.a) gt(test.t2.b, minus(test.t1.b, 1)) lt(test.t2.b, plus(test.t1.b, 1))], keep order:false, stats:pseudo" ] }, { @@ -383,25 +383,25 @@ "└─Apply 10.00 root CARTESIAN left outer semi join, other cond:eq(test.t.c, Column#21)", " ├─TableReader(Build) 10.00 root data:TableFullScan", " │ └─TableFullScan 10.00 cop[tikv] table:t keep order:false", - " └─StreamAgg(Probe) 1.00 root funcs:count(1)->Column#21", - " └─HashJoin 1.00 root inner join, equal:[eq(test.t.a, test.t.a)]", - " ├─TableReader(Build) 1.00 root data:Selection", - " │ └─Selection 1.00 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a))", - " │ └─TableFullScan 10.00 cop[tikv] table:t1 keep order:false", - " └─TableReader(Probe) 1.00 root data:Selection", - " └─Selection 1.00 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a))", - " └─TableFullScan 10.00 cop[tikv] table:s keep order:false" + " └─StreamAgg(Probe) 10.00 root funcs:count(1)->Column#21", + " └─HashJoin 10.00 root inner join, equal:[eq(test.t.a, test.t.a)]", + " ├─TableReader(Build) 10.00 root data:Selection", + " │ └─Selection 10.00 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a))", + " │ └─TableFullScan 100.00 cop[tikv] table:t1 keep order:false", + " └─TableReader(Probe) 10.00 root data:Selection", + " └─Selection 10.00 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a))", + " └─TableFullScan 100.00 cop[tikv] table:s keep order:false" ], [ "Projection 10.00 root Column#13", "└─Apply 10.00 root CARTESIAN left outer join", " ├─TableReader(Build) 10.00 root data:TableFullScan", " │ └─TableFullScan 10.00 cop[tikv] table:t keep order:false", - " └─MaxOneRow(Probe) 1.00 root ", - " └─Projection 0.10 root concat(cast(test.t.a, var_string(20)), ,, cast(test.t.b, var_string(20)))->Column#13", - " └─IndexReader 0.10 root index:Selection", - " └─Selection 0.10 cop[tikv] eq(test.t.a, test.t.a)", - " └─IndexRangeScan 1.00 cop[tikv] table:t1, index:idx(c, b, a) range: decided by [eq(test.t.c, test.t.c)], keep order:false" + " └─MaxOneRow(Probe) 10.00 root ", + " └─Projection 1.00 root concat(cast(test.t.a, var_string(20)), ,, cast(test.t.b, var_string(20)))->Column#13", + " └─IndexReader 1.00 root index:Selection", + " └─Selection 1.00 cop[tikv] eq(test.t.a, test.t.a)", + " └─IndexRangeScan 10.00 cop[tikv] table:t1, index:idx(c, b, a) range: decided by [eq(test.t.c, test.t.c)], keep order:false" ] ] }, diff --git a/planner/core/testdata/enforce_mpp_suite_out.json b/planner/core/testdata/enforce_mpp_suite_out.json index 146e33f350308..96fa1db985ac0 100644 --- a/planner/core/testdata/enforce_mpp_suite_out.json +++ b/planner/core/testdata/enforce_mpp_suite_out.json @@ -474,8 +474,8 @@ "IndexJoin_15 12500.00 root inner join, inner:TableReader_12, outer key:test.t.a, inner key:test.s.a, equal cond:eq(test.t.a, test.s.a)", "├─TableReader_32(Build) 10000.00 root data:TableFullScan_31", "│ └─TableFullScan_31 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo", - "└─TableReader_12(Probe) 1.00 root data:TableRangeScan_11", - " └─TableRangeScan_11 1.00 cop[tikv] table:s range: decided by [test.t.a], keep order:false, stats:pseudo" + "└─TableReader_12(Probe) 10000.00 root data:TableRangeScan_11", + " └─TableRangeScan_11 10000.00 cop[tikv] table:s range: decided by [test.t.a], keep order:false, stats:pseudo" ], "Warn": [ "MPP mode may be blocked because you have used hint to specify a join algorithm which is not supported by mpp now.", @@ -488,8 +488,8 @@ "IndexHashJoin_16 12500.00 root inner join, inner:TableReader_11, outer key:test.t.a, inner key:test.s.a, equal cond:eq(test.t.a, test.s.a)", "├─TableReader_31(Build) 10000.00 root data:TableFullScan_30", "│ └─TableFullScan_30 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo", - "└─TableReader_11(Probe) 1.00 root data:TableRangeScan_10", - " └─TableRangeScan_10 1.00 cop[tikv] table:s range: decided by [test.t.a], keep order:false, stats:pseudo" + "└─TableReader_11(Probe) 10000.00 root data:TableRangeScan_10", + " └─TableRangeScan_10 10000.00 cop[tikv] table:s range: decided by [test.t.a], keep order:false, stats:pseudo" ], "Warn": [ "MPP mode may be blocked because you have used hint to specify a join algorithm which is not supported by mpp now.", diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index a42fe6c2f03e8..4ffc80ce82787 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -143,9 +143,9 @@ "IndexJoin 3.00 root inner join, inner:IndexLookUp, outer key:test.t1.c, inner key:test.t2.c, equal cond:eq(test.t1.a, test.t2.a), eq(test.t1.b, test.t2.b), eq(test.t1.c, test.t2.c)", "├─TableReader(Build) 3.00 root data:TableFullScan", "│ └─TableFullScan 3.00 cop[tikv] table:t1 keep order:false", - "└─IndexLookUp(Probe) 1.00 root ", - " ├─IndexRangeScan(Build) 1.00 cop[tikv] table:t2, index:idx2(c) range: decided by [eq(test.t2.c, test.t1.c)], keep order:false", - " └─TableRowIDScan(Probe) 1.00 cop[tikv] table:t2 keep order:false" + "└─IndexLookUp(Probe) 3.00 root ", + " ├─IndexRangeScan(Build) 3.00 cop[tikv] table:t2, index:idx2(c) range: decided by [eq(test.t2.c, test.t1.c)], keep order:false", + " └─TableRowIDScan(Probe) 3.00 cop[tikv] table:t2 keep order:false" ] } ] @@ -405,13 +405,13 @@ " ├─TableReader(Build) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─Selection(Probe) 0.80 root not(isnull(test.t.a))", - " └─Projection 1.00 root test.t.a", - " └─TopN 1.00 root Column#7, offset:0, count:1", - " └─Projection 1.00 root test.t.a, plus(test.t.a, test.t.a)->Column#7", - " └─TableReader 1.00 root data:TopN", - " └─TopN 1.00 cop[tikv] plus(test.t.a, test.t.a), offset:0, count:1", - " └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + " └─Selection(Probe) 7992.00 root not(isnull(test.t.a))", + " └─Projection 9990.00 root test.t.a", + " └─TopN 9990.00 root Column#7, offset:0, count:1", + " └─Projection 9990.00 root test.t.a, plus(test.t.a, test.t.a)->Column#7", + " └─TableReader 9990.00 root data:TopN", + " └─TopN 9990.00 cop[tikv] plus(test.t.a, test.t.a), offset:0, count:1", + " └─TableFullScan 99900000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { @@ -454,9 +454,9 @@ "IndexJoin 12487.50 root inner join, inner:TableReader, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a), eq(test.t1.b, test.t2.b)", "├─IndexReader(Build) 9990.00 root index:IndexFullScan", "│ └─IndexFullScan 9990.00 cop[tikv] table:t1, index:idx_t1_b(b) keep order:false, stats:pseudo", - "└─TableReader(Probe) 1.00 root data:Selection", - " └─Selection 1.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [test.t1.a], keep order:false, stats:pseudo" + "└─TableReader(Probe) 9980.01 root data:Selection", + " └─Selection 9980.01 cop[tikv] not(isnull(test.t2.b))", + " └─TableRangeScan 9990.00 cop[tikv] table:t2 range: decided by [test.t1.a], keep order:false, stats:pseudo" ] }, { @@ -465,9 +465,9 @@ "IndexJoin 12487.50 root inner join, inner:TableReader, outer key:test.t1.a, test.t1.b, inner key:test.t2.a, test.t2.a, equal cond:eq(test.t1.a, test.t2.a), eq(test.t1.b, test.t2.a), eq(test.t1.b, test.t2.b)", "├─IndexReader(Build) 9990.00 root index:IndexFullScan", "│ └─IndexFullScan 9990.00 cop[tikv] table:t1, index:idx_t1_b(b) keep order:false, stats:pseudo", - "└─TableReader(Probe) 1.00 root data:Selection", - " └─Selection 1.00 cop[tikv] not(isnull(test.t2.b))", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [test.t1.a test.t1.b], keep order:false, stats:pseudo" + "└─TableReader(Probe) 9980.01 root data:Selection", + " └─Selection 9980.01 cop[tikv] not(isnull(test.t2.b))", + " └─TableRangeScan 9990.00 cop[tikv] table:t2 range: decided by [test.t1.a test.t1.b], keep order:false, stats:pseudo" ] }, { @@ -477,9 +477,9 @@ "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.a))", "│ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "└─TableReader(Probe) 0.00 root data:Selection", - " └─Selection 0.00 cop[tikv] eq(test.t4.b, 1)", - " └─TableRangeScan 1.00 cop[tikv] table:t4 range: decided by [eq(test.t4.a, test.t3.a) eq(test.t4.b, 1)], keep order:false, stats:pseudo" + "└─TableReader(Probe) 9.99 root data:Selection", + " └─Selection 9.99 cop[tikv] eq(test.t4.b, 1)", + " └─TableRangeScan 9990.00 cop[tikv] table:t4 range: decided by [eq(test.t4.a, test.t3.a) eq(test.t4.b, 1)], keep order:false, stats:pseudo" ] }, { @@ -489,9 +489,9 @@ "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", "│ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "└─TableReader(Probe) 0.00 root data:Selection", - " └─Selection 0.00 cop[tikv] eq(test.t4.a, 1)", - " └─TableRangeScan 1.00 cop[tikv] table:t4 range: decided by [eq(test.t4.b, test.t3.b) eq(test.t4.a, 1)], keep order:false, stats:pseudo" + "└─TableReader(Probe) 9.99 root data:Selection", + " └─Selection 9.99 cop[tikv] eq(test.t4.a, 1)", + " └─TableRangeScan 9990.00 cop[tikv] table:t4 range: decided by [eq(test.t4.b, test.t3.b) eq(test.t4.a, 1)], keep order:false, stats:pseudo" ] } ] @@ -506,10 +506,10 @@ "└─IndexJoin 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t.b, equal cond:eq(test.t.a, test.t.b)", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t.b))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:b(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo" + " └─IndexLookUp(Probe) 12487.50 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:b(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" ], "Warnings": [] }, @@ -520,10 +520,10 @@ "└─IndexHashJoin 12487.50 root inner join, inner:IndexLookUp, outer key:test.t.a, inner key:test.t.b, equal cond:eq(test.t.a, test.t.b)", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t.b))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:b(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo" + " └─IndexLookUp(Probe) 12487.50 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t2, index:b(b) range: decided by [eq(test.t.b, test.t.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo" ], "Warnings": [] }, @@ -536,8 +536,8 @@ "└─IndexMergeJoin(Probe) 12500.00 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─TableReader(Probe) 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [test.t.a], keep order:true, stats:pseudo" + " └─TableReader(Probe) 10000.00 root data:TableRangeScan", + " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [test.t.a], keep order:true, stats:pseudo" ], "Warnings": [] }, @@ -563,8 +563,8 @@ "IndexHashJoin 12500.00 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a)", "├─TableReader(Build) 10000.00 root data:TableFullScan", "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─TableReader(Probe) 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [test.t.a], keep order:false, stats:pseudo" + "└─TableReader(Probe) 10000.00 root data:TableRangeScan", + " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [test.t.a], keep order:false, stats:pseudo" ], "Warnings": [] }, @@ -1128,8 +1128,8 @@ "IndexJoin 3.00 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a)", "├─TableReader(Build) 3.00 root data:TableFullScan", "│ └─TableFullScan 3.00 cop[tikv] table:t1 keep order:false", - "└─TableReader(Probe) 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [eq(test.t.a, test.t.a)], keep order:false" + "└─TableReader(Probe) 3.00 root data:TableRangeScan", + " └─TableRangeScan 3.00 cop[tikv] table:t2 range: decided by [eq(test.t.a, test.t.a)], keep order:false" ], "Res": [ "1 111 1.1000000000 11 1 111 1.1000000000 11", @@ -1143,8 +1143,8 @@ "IndexMergeJoin 3.00 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a", "├─TableReader(Build) 3.00 root data:TableFullScan", "│ └─TableFullScan 3.00 cop[tikv] table:t1 keep order:false", - "└─TableReader(Probe) 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [eq(test.t.a, test.t.a)], keep order:true" + "└─TableReader(Probe) 3.00 root data:TableRangeScan", + " └─TableRangeScan 3.00 cop[tikv] table:t2 range: decided by [eq(test.t.a, test.t.a)], keep order:true" ], "Res": [ "1 111 1.1000000000 11 1 111 1.1000000000 11", @@ -1158,8 +1158,8 @@ "IndexHashJoin 3.00 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a)", "├─TableReader(Build) 3.00 root data:TableFullScan", "│ └─TableFullScan 3.00 cop[tikv] table:t1 keep order:false", - "└─TableReader(Probe) 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [eq(test.t.a, test.t.a)], keep order:false" + "└─TableReader(Probe) 3.00 root data:TableRangeScan", + " └─TableRangeScan 3.00 cop[tikv] table:t2 range: decided by [eq(test.t.a, test.t.a)], keep order:false" ], "Res": [ "1 111 1.1000000000 11 1 111 1.1000000000 11", @@ -1173,8 +1173,8 @@ "IndexJoin 3.00 root inner join, inner:TableReader, outer key:test.t.a, test.t.b, inner key:test.t.a, test.t.b, equal cond:eq(test.t.a, test.t.a), eq(test.t.b, test.t.b)", "├─TableReader(Build) 3.00 root data:TableFullScan", "│ └─TableFullScan 3.00 cop[tikv] table:t1 keep order:false", - "└─TableReader(Probe) 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [eq(test.t.a, test.t.a) eq(test.t.b, test.t.b)], keep order:false" + "└─TableReader(Probe) 3.00 root data:TableRangeScan", + " └─TableRangeScan 3.00 cop[tikv] table:t2 range: decided by [eq(test.t.a, test.t.a) eq(test.t.b, test.t.b)], keep order:false" ], "Res": [ "1 111 1.1000000000 11 1 111 1.1000000000 11", @@ -1189,10 +1189,10 @@ "├─TableReader(Build) 3.00 root data:Selection", "│ └─Selection 3.00 cop[tikv] not(isnull(test.t.c))", "│ └─TableFullScan 3.00 cop[tikv] table:t1 keep order:false", - "└─IndexLookUp(Probe) 1.00 root ", - " ├─Selection(Build) 1.00 cop[tikv] not(isnull(test.t.c))", - " │ └─IndexRangeScan 1.00 cop[tikv] table:t2, index:c(c) range: decided by [eq(test.t.c, test.t.c)], keep order:false", - " └─TableRowIDScan(Probe) 1.00 cop[tikv] table:t2 keep order:false" + "└─IndexLookUp(Probe) 3.00 root ", + " ├─Selection(Build) 3.00 cop[tikv] not(isnull(test.t.c))", + " │ └─IndexRangeScan 3.00 cop[tikv] table:t2, index:c(c) range: decided by [eq(test.t.c, test.t.c)], keep order:false", + " └─TableRowIDScan(Probe) 3.00 cop[tikv] table:t2 keep order:false" ], "Res": [ "1 111 1.1000000000 11 1 111 1.1000000000 11", @@ -1207,10 +1207,10 @@ "├─Projection(Build) 3.00 root cast(test.t.a, decimal(10,0) BINARY)->Column#9", "│ └─TableReader 3.00 root data:TableFullScan", "│ └─TableFullScan 3.00 cop[tikv] table:t1 keep order:false", - "└─Projection(Probe) 1.00 root test.t.a, test.t.c, test.t.d", - " └─IndexLookUp 1.00 root ", - " ├─IndexRangeScan(Build) 1.00 cop[tikv] table:t2, index:c(c) range: decided by [eq(test.t.c, Column#9)], keep order:true", - " └─TableRowIDScan(Probe) 1.00 cop[tikv] table:t2 keep order:false" + "└─Projection(Probe) 3.00 root test.t.a, test.t.c, test.t.d", + " └─IndexLookUp 3.00 root ", + " ├─IndexRangeScan(Build) 3.00 cop[tikv] table:t2, index:c(c) range: decided by [eq(test.t.c, Column#9)], keep order:true", + " └─TableRowIDScan(Probe) 3.00 cop[tikv] table:t2 keep order:false" ], "Res": [ " ", @@ -1506,16 +1506,16 @@ "│ ├─IndexLookUp(Build) 10.00 root ", "│ │ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t3, index:keycol(keycol, pad1, pad2) range:[\"c\",\"c\"], keep order:false, stats:pseudo", "│ │ └─TableRowIDScan(Probe) 10.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.81 cop[tikv] not(isnull(test.t1.col3))", - "│ │ └─IndexRangeScan 1.81 cop[tikv] table:t1, index:col2(col2, col3) range: decided by [eq(test.t1.col3, test.t3.pk) eq(test.t1.col2, a)], keep order:false, stats:pseudo", - "│ └─Selection(Probe) 1.25 cop[tikv] ne(test.t1.col1, \"aaaaaa\"), ne(test.t1.col1, \"abcdef\"), not(isnull(test.t1.col1))", - "│ └─TableRowIDScan 1.81 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.00 root ", - " ├─Selection(Build) 1.00 cop[tikv] ne(test.t2.pk, \"aaaaaa\"), ne(test.t2.pk, \"abcdef\")", - " │ └─IndexRangeScan 1.00 cop[tikv] table:t2, index:PRIMARY(pk) range: decided by [eq(test.t2.pk, test.t1.col1)], keep order:false, stats:pseudo", - " └─Selection(Probe) 1.00 cop[tikv] in(test.t2.col1, \"a\", \"b\")", - " └─TableRowIDScan 1.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + "│ └─IndexLookUp(Probe) 12.50 root ", + "│ ├─Selection(Build) 18.10 cop[tikv] not(isnull(test.t1.col3))", + "│ │ └─IndexRangeScan 18.12 cop[tikv] table:t1, index:col2(col2, col3) range: decided by [eq(test.t1.col3, test.t3.pk) eq(test.t1.col2, a)], keep order:false, stats:pseudo", + "│ └─Selection(Probe) 12.50 cop[tikv] ne(test.t1.col1, \"aaaaaa\"), ne(test.t1.col1, \"abcdef\"), not(isnull(test.t1.col1))", + "│ └─TableRowIDScan 18.10 cop[tikv] table:t1 keep order:false, stats:pseudo", + "└─IndexLookUp(Probe) 12.50 root ", + " ├─Selection(Build) 12.50 cop[tikv] ne(test.t2.pk, \"aaaaaa\"), ne(test.t2.pk, \"abcdef\")", + " │ └─IndexRangeScan 12.50 cop[tikv] table:t2, index:PRIMARY(pk) range: decided by [eq(test.t2.pk, test.t1.col1)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12.50 cop[tikv] in(test.t2.col1, \"a\", \"b\")", + " └─TableRowIDScan 12.50 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { @@ -1526,16 +1526,16 @@ "│ ├─IndexLookUp(Build) 10.00 root ", "│ │ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t3, index:keycol(keycol, pad1, pad2) range:[\"c\",\"c\"], keep order:false, stats:pseudo", "│ │ └─TableRowIDScan(Probe) 10.00 cop[tikv] table:t3 keep order:false, stats:pseudo", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.81 cop[tikv] not(isnull(test.t1.col3))", - "│ │ └─IndexRangeScan 1.81 cop[tikv] table:t1, index:col2(col2, col3) range: decided by [eq(test.t1.col3, test.t3.pk) eq(test.t1.col2, a)], keep order:false, stats:pseudo", - "│ └─Selection(Probe) 1.25 cop[tikv] ne(test.t1.col1, \"aaaaaa\"), ne(test.t1.col1, \"abcdef\"), not(isnull(test.t1.col1))", - "│ └─TableRowIDScan 1.81 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.00 root ", - " ├─Selection(Build) 1.00 cop[tikv] ne(test.t2.pk, \"aaaaaa\"), ne(test.t2.pk, \"abcdef\")", - " │ └─IndexRangeScan 1.00 cop[tikv] table:t2, index:PRIMARY(pk) range: decided by [eq(test.t2.pk, test.t1.col1)], keep order:false, stats:pseudo", - " └─Selection(Probe) 1.00 cop[tikv] in(test.t2.col1, \"a\", \"b\")", - " └─TableRowIDScan 1.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + "│ └─IndexLookUp(Probe) 12.50 root ", + "│ ├─Selection(Build) 18.10 cop[tikv] not(isnull(test.t1.col3))", + "│ │ └─IndexRangeScan 18.12 cop[tikv] table:t1, index:col2(col2, col3) range: decided by [eq(test.t1.col3, test.t3.pk) eq(test.t1.col2, a)], keep order:false, stats:pseudo", + "│ └─Selection(Probe) 12.50 cop[tikv] ne(test.t1.col1, \"aaaaaa\"), ne(test.t1.col1, \"abcdef\"), not(isnull(test.t1.col1))", + "│ └─TableRowIDScan 18.10 cop[tikv] table:t1 keep order:false, stats:pseudo", + "└─IndexLookUp(Probe) 12.50 root ", + " ├─Selection(Build) 12.50 cop[tikv] ne(test.t2.pk, \"aaaaaa\"), ne(test.t2.pk, \"abcdef\")", + " │ └─IndexRangeScan 12.50 cop[tikv] table:t2, index:PRIMARY(pk) range: decided by [eq(test.t2.pk, test.t1.col1)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12.50 cop[tikv] in(test.t2.col1, \"a\", \"b\")", + " └─TableRowIDScan 12.50 cop[tikv] table:t2 keep order:false, stats:pseudo" ] } ] @@ -1663,11 +1663,11 @@ "└─Apply 10000.00 root CARTESIAN semi join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─Limit(Probe) 2.00 root offset:1, count:2", - " └─TableReader 3.00 root data:Limit", - " └─Limit 3.00 cop[tikv] offset:0, count:3", - " └─Selection 3.00 cop[tikv] eq(test.test.id, test.test.id)", - " └─TableFullScan 3000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" + " └─Limit(Probe) 20000.00 root offset:1, count:2", + " └─TableReader 30000.00 root data:Limit", + " └─Limit 30000.00 cop[tikv] offset:0, count:3", + " └─Selection 30000.00 cop[tikv] eq(test.test.id, test.test.id)", + " └─TableFullScan 30000000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { @@ -1676,12 +1676,12 @@ "Apply 10000.00 root CARTESIAN semi join", "├─TableReader(Build) 10000.00 root data:TableFullScan", "│ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - "└─Selection(Probe) 2.40 root eq(9, test.t.c)", - " └─Limit 3.00 root offset:0, count:3", - " └─TableReader 3.00 root data:Limit", - " └─Limit 3.00 cop[tikv] offset:0, count:3", - " └─Selection 3.00 cop[tikv] lt(test.t.c, test.t.c)", - " └─TableFullScan 3.75 cop[tikv] table:s keep order:false, stats:pseudo" + "└─Selection(Probe) 24000.00 root eq(9, test.t.c)", + " └─Limit 30000.00 root offset:0, count:3", + " └─TableReader 30000.00 root data:Limit", + " └─Limit 30000.00 cop[tikv] offset:0, count:3", + " └─Selection 30000.00 cop[tikv] lt(test.t.c, test.t.c)", + " └─TableFullScan 37500.00 cop[tikv] table:s keep order:false, stats:pseudo" ] } ] @@ -1707,11 +1707,11 @@ "└─Apply 10000.00 root CARTESIAN left outer join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─MaxOneRow(Probe) 1.00 root ", - " └─IndexLookUp 0.02 root ", - " ├─Selection(Build) 0.02 cop[tikv] or(eq(test.t2.b, 1), eq(test.t2.b, 2))", - " │ └─IndexRangeScan 10.00 cop[tikv] table:t2, index:PRIMARY(a, b) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 0.02 cop[tikv] table:t2 keep order:false, stats:pseudo" + " └─MaxOneRow(Probe) 10000.00 root ", + " └─IndexLookUp 200.00 root ", + " ├─Selection(Build) 200.00 cop[tikv] or(eq(test.t2.b, 1), eq(test.t2.b, 2))", + " │ └─IndexRangeScan 100000.00 cop[tikv] table:t2, index:PRIMARY(a, b) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 200.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] } ] @@ -2301,14 +2301,14 @@ " └─Apply 10000.00 root CARTESIAN inner join, other cond:or(and(lt(test.t2.c1, Column#8), if(ne(Column#9, 0), NULL, 1)), or(eq(Column#10, 0), if(isnull(test.t2.c1), NULL, 0)))", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─StreamAgg(Probe) 1.00 root funcs:min(test.t1.c1)->Column#8, funcs:sum(0)->Column#9, funcs:count(1)->Column#10", - " └─IndexMerge 0.01 root ", - " ├─Selection(Build) 1.00 cop[tikv] eq(10, test.t2.c3)", - " │ └─TableRangeScan 1.00 cop[tikv] table:t1 range:[10,10], keep order:false, stats:pseudo", - " ├─Selection(Build) 8.00 cop[tikv] eq(1, test.t2.c3)", - " │ └─IndexRangeScan 10.00 cop[tikv] table:t1, index:c2(c2) range:[1,1], keep order:false, stats:pseudo", - " └─Selection(Probe) 0.01 cop[tikv] or(and(eq(test.t1.c1, 10), eq(10, test.t2.c3)), and(eq(test.t1.c2, 1), eq(1, test.t2.c3))), substring(cast(test.t1.c3, var_string(20)), 10)", - " └─TableRowIDScan 9.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + " └─StreamAgg(Probe) 10000.00 root funcs:min(test.t1.c1)->Column#8, funcs:sum(0)->Column#9, funcs:count(1)->Column#10", + " └─IndexMerge 63.35 root ", + " ├─Selection(Build) 10000.00 cop[tikv] eq(10, test.t2.c3)", + " │ └─TableRangeScan 10000.00 cop[tikv] table:t1 range:[10,10], keep order:false, stats:pseudo", + " ├─Selection(Build) 80000.00 cop[tikv] eq(1, test.t2.c3)", + " │ └─IndexRangeScan 100000.00 cop[tikv] table:t1, index:c2(c2) range:[1,1], keep order:false, stats:pseudo", + " └─Selection(Probe) 63.35 cop[tikv] or(and(eq(test.t1.c1, 10), eq(10, test.t2.c3)), and(eq(test.t1.c2, 1), eq(1, test.t2.c3))), substring(cast(test.t1.c3, var_string(20)), 10)", + " └─TableRowIDScan 89992.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Res": [ "1 1 1", @@ -2323,14 +2323,14 @@ " └─Apply 10000.00 root CARTESIAN inner join, other cond:or(and(lt(test.t2.c1, Column#8), if(ne(Column#9, 0), NULL, 1)), or(eq(Column#10, 0), if(isnull(test.t2.c1), NULL, 0)))", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─StreamAgg(Probe) 1.00 root funcs:min(test.t1.c1)->Column#8, funcs:sum(0)->Column#9, funcs:count(1)->Column#10", - " └─IndexMerge 0.01 root ", - " ├─Selection(Build) 1.00 cop[tikv] eq(10, test.t2.c3)", - " │ └─TableRangeScan 1.00 cop[tikv] table:t1 range:[10,10], keep order:false, stats:pseudo", - " ├─Selection(Build) 8.00 cop[tikv] eq(1, test.t2.c3)", - " │ └─IndexRangeScan 10.00 cop[tikv] table:t1, index:c2(c2) range:[1,1], keep order:false, stats:pseudo", - " └─Selection(Probe) 0.01 cop[tikv] or(and(eq(test.t1.c1, 10), eq(10, test.t2.c3)), and(eq(test.t1.c2, 1), eq(1, test.t2.c3))), reverse(cast(test.t1.c3, var_string(20)))", - " └─TableRowIDScan 9.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + " └─StreamAgg(Probe) 10000.00 root funcs:min(test.t1.c1)->Column#8, funcs:sum(0)->Column#9, funcs:count(1)->Column#10", + " └─IndexMerge 63.35 root ", + " ├─Selection(Build) 10000.00 cop[tikv] eq(10, test.t2.c3)", + " │ └─TableRangeScan 10000.00 cop[tikv] table:t1 range:[10,10], keep order:false, stats:pseudo", + " ├─Selection(Build) 80000.00 cop[tikv] eq(1, test.t2.c3)", + " │ └─IndexRangeScan 100000.00 cop[tikv] table:t1, index:c2(c2) range:[1,1], keep order:false, stats:pseudo", + " └─Selection(Probe) 63.35 cop[tikv] or(and(eq(test.t1.c1, 10), eq(10, test.t2.c3)), and(eq(test.t1.c2, 1), eq(1, test.t2.c3))), reverse(cast(test.t1.c3, var_string(20)))", + " └─TableRowIDScan 89992.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Res": [ "2 2 2" @@ -2344,14 +2344,14 @@ " └─Apply 10000.00 root CARTESIAN inner join, other cond:or(and(lt(test.t2.c1, Column#8), if(ne(Column#9, 0), NULL, 1)), or(eq(Column#10, 0), if(isnull(test.t2.c1), NULL, 0)))", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─StreamAgg(Probe) 1.00 root funcs:min(test.t1.c1)->Column#8, funcs:sum(0)->Column#9, funcs:count(1)->Column#10", - " └─IndexMerge 3.03 root ", - " ├─Selection(Build) 3.33 cop[tikv] eq(test.t1.c1, test.t2.c3)", - " │ └─TableRangeScan 3333.33 cop[tikv] table:t1 range:[10,+inf], keep order:false, stats:pseudo", - " ├─Selection(Build) 8.00 cop[tikv] eq(1, test.t2.c3)", - " │ └─IndexRangeScan 10.00 cop[tikv] table:t1, index:c2(c2) range:[1,1], keep order:false, stats:pseudo", - " └─Selection(Probe) 3.03 cop[tikv] or(and(ge(test.t1.c1, 10), eq(test.t1.c1, test.t2.c3)), and(eq(test.t1.c2, 1), eq(1, test.t2.c3))), substring(cast(test.t1.c3, var_string(20)), 10)", - " └─TableRowIDScan 3338.67 cop[tikv] table:t1 keep order:false, stats:pseudo" + " └─StreamAgg(Probe) 10000.00 root funcs:min(test.t1.c1)->Column#8, funcs:sum(0)->Column#9, funcs:count(1)->Column#10", + " └─IndexMerge 30263.46 root ", + " ├─Selection(Build) 33333.33 cop[tikv] eq(test.t1.c1, test.t2.c3)", + " │ └─TableRangeScan 33333333.33 cop[tikv] table:t1 range:[10,+inf], keep order:false, stats:pseudo", + " ├─Selection(Build) 80000.00 cop[tikv] eq(1, test.t2.c3)", + " │ └─IndexRangeScan 100000.00 cop[tikv] table:t1, index:c2(c2) range:[1,1], keep order:false, stats:pseudo", + " └─Selection(Probe) 30263.46 cop[tikv] or(and(ge(test.t1.c1, 10), eq(test.t1.c1, test.t2.c3)), and(eq(test.t1.c2, 1), eq(1, test.t2.c3))), substring(cast(test.t1.c3, var_string(20)), 10)", + " └─TableRowIDScan 33386666.67 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Res": [ "1 1 1", @@ -2365,15 +2365,15 @@ "└─Apply 10000.00 root CARTESIAN inner join, other cond:or(and(lt(test.tt1.c_decimal, Column#9), if(ne(Column#10, 0), NULL, 1)), or(eq(Column#11, 0), if(isnull(test.tt1.c_decimal), NULL, 0)))", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:tt1 keep order:true, stats:pseudo", - " └─StreamAgg(Probe) 1.00 root funcs:min(Column#14)->Column#9, funcs:sum(Column#15)->Column#10, funcs:count(1)->Column#11", - " └─Projection 0.00 root test.tt2.c_decimal, cast(isnull(test.tt2.c_decimal), decimal(20,0) BINARY)->Column#15", - " └─IndexMerge 0.00 root ", - " ├─Selection(Build) 0.00 cop[tikv] eq(test.tt1.c_int, test.tt2.c_int)", - " │ └─IndexRangeScan 1.00 cop[tikv] table:tt2, index:c_decimal(c_decimal) range:[9.060000,9.060000], keep order:false, stats:pseudo", - " ├─Selection(Build) 3.32 cop[tikv] eq(test.tt1.c_int, test.tt2.c_int)", - " │ └─IndexRangeScan 3323.33 cop[tikv] table:tt2, index:c_str(c_str) range:[-inf,\"interesting shtern\"], keep order:false, stats:pseudo", - " └─Selection(Probe) 0.00 cop[tikv] or(and(eq(test.tt1.c_int, test.tt2.c_int), and(gt(test.tt1.c_datetime, test.tt2.c_datetime), eq(test.tt2.c_decimal, 9.060))), and(le(test.tt2.c_str, \"interesting shtern\"), eq(test.tt1.c_int, test.tt2.c_int)))", - " └─TableRowIDScan 3.32 cop[tikv] table:tt2 keep order:false, stats:pseudo" + " └─StreamAgg(Probe) 10000.00 root funcs:min(Column#14)->Column#9, funcs:sum(Column#15)->Column#10, funcs:count(1)->Column#11", + " └─Projection 11.05 root test.tt2.c_decimal, cast(isnull(test.tt2.c_decimal), decimal(20,0) BINARY)->Column#15", + " └─IndexMerge 11.05 root ", + " ├─Selection(Build) 10.00 cop[tikv] eq(test.tt1.c_int, test.tt2.c_int)", + " │ └─IndexRangeScan 10000.00 cop[tikv] table:tt2, index:c_decimal(c_decimal) range:[9.060000,9.060000], keep order:false, stats:pseudo", + " ├─Selection(Build) 33233.33 cop[tikv] eq(test.tt1.c_int, test.tt2.c_int)", + " │ └─IndexRangeScan 33233333.33 cop[tikv] table:tt2, index:c_str(c_str) range:[-inf,\"interesting shtern\"], keep order:false, stats:pseudo", + " └─Selection(Probe) 11.05 cop[tikv] or(and(eq(test.tt1.c_int, test.tt2.c_int), and(gt(test.tt1.c_datetime, test.tt2.c_datetime), eq(test.tt2.c_decimal, 9.060))), and(le(test.tt2.c_str, \"interesting shtern\"), eq(test.tt1.c_int, test.tt2.c_int)))", + " └─TableRowIDScan 33243.33 cop[tikv] table:tt2 keep order:false, stats:pseudo" ], "Res": [ "7", @@ -2388,15 +2388,15 @@ "└─Apply 10000.00 root CARTESIAN inner join, other cond:or(and(gt(test.tt1.c_decimal, Column#9), if(ne(Column#10, 0), NULL, 1)), or(eq(Column#11, 0), if(isnull(test.tt1.c_decimal), NULL, 0)))", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:tt1 keep order:true, stats:pseudo", - " └─StreamAgg(Probe) 1.00 root funcs:max(Column#14)->Column#9, funcs:sum(Column#15)->Column#10, funcs:count(1)->Column#11", - " └─Projection 0.00 root test.tt2.c_decimal, cast(isnull(test.tt2.c_decimal), decimal(20,0) BINARY)->Column#15", - " └─IndexMerge 0.00 root ", - " ├─Selection(Build) 1.00 cop[tikv] lt(7, test.tt1.c_decimal)", - " │ └─TableRangeScan 1.00 cop[tikv] table:tt2 range:[7,7], keep order:false, stats:pseudo", - " ├─Selection(Build) 3.33 cop[tikv] eq(test.tt1.c_int, test.tt2.c_int)", - " │ └─IndexRangeScan 3333.33 cop[tikv] table:tt2, index:c_str(c_str) range:[\"zzzzzzzzzzzzzzzzzzz\",+inf], keep order:false, stats:pseudo", - " └─Selection(Probe) 0.00 cop[tikv] or(and(eq(test.tt2.c_int, 7), lt(7, test.tt1.c_decimal)), and(ge(test.tt2.c_str, \"zzzzzzzzzzzzzzzzzzz\"), eq(test.tt1.c_int, test.tt2.c_int)))", - " └─TableRowIDScan 4.33 cop[tikv] table:tt2 keep order:false, stats:pseudo" + " └─StreamAgg(Probe) 10000.00 root funcs:max(Column#14)->Column#9, funcs:sum(Column#15)->Column#10, funcs:count(1)->Column#11", + " └─Projection 17.91 root test.tt2.c_decimal, cast(isnull(test.tt2.c_decimal), decimal(20,0) BINARY)->Column#15", + " └─IndexMerge 17.91 root ", + " ├─Selection(Build) 10000.00 cop[tikv] lt(7, test.tt1.c_decimal)", + " │ └─TableRangeScan 10000.00 cop[tikv] table:tt2 range:[7,7], keep order:false, stats:pseudo", + " ├─Selection(Build) 33333.33 cop[tikv] eq(test.tt1.c_int, test.tt2.c_int)", + " │ └─IndexRangeScan 33333333.33 cop[tikv] table:tt2, index:c_str(c_str) range:[\"zzzzzzzzzzzzzzzzzzz\",+inf], keep order:false, stats:pseudo", + " └─Selection(Probe) 17.91 cop[tikv] or(and(eq(test.tt2.c_int, 7), lt(7, test.tt1.c_decimal)), and(ge(test.tt2.c_str, \"zzzzzzzzzzzzzzzzzzz\"), eq(test.tt1.c_int, test.tt2.c_int)))", + " └─TableRowIDScan 43330.00 cop[tikv] table:tt2 keep order:false, stats:pseudo" ], "Res": [ "6", @@ -2630,12 +2630,12 @@ " └─Apply_22 3.00 76.02 root CARTESIAN left outer join", " ├─TableReader_24(Build) 3.00 10.16 root data:TableFullScan_23", " │ └─TableFullScan_23 3.00 108.00 cop[tikv] table:t keep order:false", - " └─Projection_27(Probe) 1.00 21.95 root 1->Column#26", - " └─Limit_30 1.00 3.35 root offset:0, count:1", - " └─TableReader_38 1.00 3.35 root data:ExchangeSender_37", - " └─ExchangeSender_37 1.00 19.50 mpp[tiflash] ExchangeType: PassThrough", - " └─Limit_36 1.00 19.50 mpp[tiflash] offset:0, count:1", - " └─TableFullScan_35 1.00 19.50 mpp[tiflash] table:t2 keep order:false" + " └─Projection_27(Probe) 3.00 21.95 root 1->Column#26", + " └─Limit_30 3.00 3.35 root offset:0, count:1", + " └─TableReader_38 3.00 3.35 root data:ExchangeSender_37", + " └─ExchangeSender_37 3.00 19.50 mpp[tiflash] ExchangeType: PassThrough", + " └─Limit_36 3.00 19.50 mpp[tiflash] offset:0, count:1", + " └─TableFullScan_35 3.00 19.50 mpp[tiflash] table:t2 keep order:false" ] }, { @@ -4465,11 +4465,11 @@ "├─TableReader(Build) 9980.01 root data:Selection", "│ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", "│ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.s.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", - " └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.s.b))", - " └─TableRowIDScan 1.25 cop[tikv] table:s keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.s.a))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.s.b))", + " └─TableRowIDScan 12487.50 cop[tikv] table:s keep order:false, stats:pseudo" ] }, { @@ -4479,10 +4479,10 @@ "├─TableReader(Build) 9980.01 root data:Selection", "│ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", "│ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.s.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:s keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12475.01 cop[tikv] not(isnull(test.s.a))", + " │ └─IndexRangeScan 12487.50 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12475.01 cop[tikv] table:s keep order:false, stats:pseudo" ] }, { @@ -4492,11 +4492,11 @@ "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", "│ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.s.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", - " └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.s.b))", - " └─TableRowIDScan 1.25 cop[tikv] table:s keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.s.a))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.s.b))", + " └─TableRowIDScan 12487.50 cop[tikv] table:s keep order:false, stats:pseudo" ] }, { @@ -4506,11 +4506,11 @@ "├─TableReader(Build) 9980.01 root data:Selection", "│ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", "│ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.s.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", - " └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.s.b))", - " └─TableRowIDScan 1.25 cop[tikv] table:s keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.s.a))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.s.b))", + " └─TableRowIDScan 12487.50 cop[tikv] table:s keep order:false, stats:pseudo" ] }, { @@ -4520,10 +4520,10 @@ "├─TableReader(Build) 9980.01 root data:Selection", "│ └─Selection 9980.01 cop[tikv] not(isnull(test.t.a)), not(isnull(test.t.b))", "│ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.s.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:s keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12475.01 cop[tikv] not(isnull(test.s.a))", + " │ └─IndexRangeScan 12487.50 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12475.01 cop[tikv] table:s keep order:false, stats:pseudo" ] }, { @@ -4533,11 +4533,11 @@ "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", "│ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.s.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", - " └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.s.b))", - " └─TableRowIDScan 1.25 cop[tikv] table:s keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.s.a))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:s, index:a(a) range: decided by [eq(test.s.a, test.t.a)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.s.b))", + " └─TableRowIDScan 12487.50 cop[tikv] table:s keep order:false, stats:pseudo" ] } ] @@ -6280,11 +6280,11 @@ " └─Apply 10000.00 root CARTESIAN left outer join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " └─Projection(Probe) 1.00 root 1->Column#25", - " └─Limit 1.00 root offset:0, count:1", - " └─TableReader 1.00 root data:Limit", - " └─Limit 1.00 cop[tikv] offset:0, count:1", - " └─TableFullScan 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + " └─Projection(Probe) 10000.00 root 1->Column#25", + " └─Limit 10000.00 root offset:0, count:1", + " └─TableReader 10000.00 root data:Limit", + " └─Limit 10000.00 cop[tikv] offset:0, count:1", + " └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Res": [ "1", @@ -7406,11 +7406,11 @@ "├─TableReader(Build) 9980.01 root data:Selection", "│ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.e)), not(isnull(test.t2.g))", "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 0.00 root ", - " ├─Selection(Build) 0.03 cop[tikv] not(isnull(test.t1.b))", - " │ └─IndexRangeScan 0.03 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.b, test.t2.e) eq(test.t1.d, test.t2.g) in(test.t1.a, 1, 3) in(test.t1.c, aaa, bbb)], keep order:false, stats:pseudo", - " └─Selection(Probe) 0.00 cop[tikv] in(test.t1.c, \"aaa\", \"bbb\"), not(isnull(test.t1.d))", - " └─TableRowIDScan 0.03 cop[tikv] table:t1 keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 0.50 root ", + " ├─Selection(Build) 249.75 cop[tikv] not(isnull(test.t1.b))", + " │ └─IndexRangeScan 250.00 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.b, test.t2.e) eq(test.t1.d, test.t2.g) in(test.t1.a, 1, 3) in(test.t1.c, aaa, bbb)], keep order:false, stats:pseudo", + " └─Selection(Probe) 0.50 cop[tikv] in(test.t1.c, \"aaa\", \"bbb\"), not(isnull(test.t1.d))", + " └─TableRowIDScan 249.75 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Warn": null }, @@ -7426,11 +7426,11 @@ "├─TableReader(Build) 9980.01 root data:Selection", "│ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.e)), not(isnull(test.t2.g))", "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 0.00 root ", - " ├─Selection(Build) 0.03 cop[tikv] not(isnull(test.t1.b))", - " │ └─IndexRangeScan 0.03 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.b, test.t2.e) in(test.t1.a, 1, 3) in(test.t1.c, aaa, bbb)], keep order:false, stats:pseudo", - " └─Selection(Probe) 0.00 cop[tikv] in(test.t1.c, \"aaa\", \"bbb\"), not(isnull(test.t1.d))", - " └─TableRowIDScan 0.03 cop[tikv] table:t1 keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 0.50 root ", + " ├─Selection(Build) 249.75 cop[tikv] not(isnull(test.t1.b))", + " │ └─IndexRangeScan 250.00 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.b, test.t2.e) in(test.t1.a, 1, 3) in(test.t1.c, aaa, bbb)], keep order:false, stats:pseudo", + " └─Selection(Probe) 0.50 cop[tikv] in(test.t1.c, \"aaa\", \"bbb\"), not(isnull(test.t1.d))", + " └─TableRowIDScan 249.75 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Warn": [ "Memory capacity of 2900 bytes for 'tidb_opt_range_max_size' exceeded when building ranges. Less accurate ranges such as full range are chosen" @@ -7448,11 +7448,11 @@ "├─TableReader(Build) 9980.01 root data:Selection", "│ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.e)), not(isnull(test.t2.g))", "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 0.00 root ", - " ├─Selection(Build) 0.03 cop[tikv] not(isnull(test.t1.b))", - " │ └─IndexRangeScan 0.03 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.b, test.t2.e) in(test.t1.a, 1, 3)], keep order:false, stats:pseudo", - " └─Selection(Probe) 0.00 cop[tikv] in(test.t1.c, \"aaa\", \"bbb\"), not(isnull(test.t1.d))", - " └─TableRowIDScan 0.03 cop[tikv] table:t1 keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 0.50 root ", + " ├─Selection(Build) 249.75 cop[tikv] not(isnull(test.t1.b))", + " │ └─IndexRangeScan 250.00 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.b, test.t2.e) in(test.t1.a, 1, 3)], keep order:false, stats:pseudo", + " └─Selection(Probe) 0.50 cop[tikv] in(test.t1.c, \"aaa\", \"bbb\"), not(isnull(test.t1.d))", + " └─TableRowIDScan 249.75 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Warn": [ "Memory capacity of 2300 bytes for 'tidb_opt_range_max_size' exceeded when building ranges. Less accurate ranges such as full range are chosen" @@ -7493,10 +7493,10 @@ "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.e))", "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 0.03 root ", - " ├─Selection(Build) 0.03 cop[tikv] not(isnull(test.t1.a))", - " │ └─IndexRangeScan 0.03 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.a, test.t2.e) gt(test.t1.b, 1) lt(test.t1.b, 10)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 0.03 cop[tikv] table:t1 keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 312.19 root ", + " ├─Selection(Build) 312.19 cop[tikv] not(isnull(test.t1.a))", + " │ └─IndexRangeScan 312.50 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.a, test.t2.e) gt(test.t1.b, 1) lt(test.t1.b, 10)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 312.19 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Warn": null }, @@ -7512,10 +7512,10 @@ "├─TableReader(Build) 9990.00 root data:Selection", "│ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.e))", "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 0.03 root ", - " ├─Selection(Build) 0.03 cop[tikv] gt(test.t1.b, 1), lt(test.t1.b, 10), not(isnull(test.t1.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.a, test.t2.e)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 0.03 cop[tikv] table:t1 keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 312.19 root ", + " ├─Selection(Build) 312.19 cop[tikv] gt(test.t1.b, 1), lt(test.t1.b, 10), not(isnull(test.t1.a))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.a, test.t2.e)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 312.19 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Warn": [ "Memory capacity of 300 bytes for 'tidb_opt_range_max_size' exceeded when building ranges. Less accurate ranges such as full range are chosen" @@ -7533,10 +7533,10 @@ "├─TableReader(Build) 9980.01 root data:Selection", "│ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.e)), not(isnull(test.t2.f))", "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.a, test.t2.e) gt(test.t1.b, test.t2.f) lt(test.t1.b, plus(test.t2.f, 10))], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12475.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.a, test.t2.e) gt(test.t1.b, test.t2.f) lt(test.t1.b, plus(test.t2.f, 10))], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12475.01 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Warn": null }, @@ -7552,10 +7552,10 @@ "├─TableReader(Build) 9980.01 root data:Selection", "│ └─Selection 9980.01 cop[tikv] not(isnull(test.t2.e)), not(isnull(test.t2.f))", "│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.a, test.t2.e)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo" + "└─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12475.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:idx_a_b_c_d(a, b, c, d) range: decided by [eq(test.t1.a, test.t2.e)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 12475.01 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Warn": [ "Memory capacity of 300 bytes for 'tidb_opt_range_max_size' exceeded when building ranges. Less accurate ranges such as full range are chosen" diff --git a/planner/core/testdata/join_reorder_suite_out.json b/planner/core/testdata/join_reorder_suite_out.json index 41ed45dcb3cd4..1e385b764f07e 100644 --- a/planner/core/testdata/join_reorder_suite_out.json +++ b/planner/core/testdata/join_reorder_suite_out.json @@ -2136,11 +2136,11 @@ " ├─TableReader(Build) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", " │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", - " └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.t1.b))", - " └─TableRowIDScan 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo" + " └─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t1.a))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.t1.b))", + " └─TableRowIDScan 12487.50 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Warning": null }, @@ -2205,11 +2205,11 @@ " ├─TableReader(Build) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", " │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", - " └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.t1.b))", - " └─TableRowIDScan 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo" + " └─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t1.a))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.t1.b))", + " └─TableRowIDScan 12487.50 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Warning": null }, @@ -2279,11 +2279,11 @@ " ├─TableReader(Build) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", " │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", - " └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.t1.b))", - " └─TableRowIDScan 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo" + " └─IndexLookUp(Probe) 12475.01 root ", + " ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t1.a))", + " │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", + " └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.t1.b))", + " └─TableRowIDScan 12487.50 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Warning": null } @@ -6300,9 +6300,9 @@ " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " │ └─IndexReader(Probe) 1.25 root index:Selection", - " │ └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + " │ └─IndexReader(Probe) 3.75 root index:Selection", + " │ └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", " └─MaxOneRow(Probe) 1.00 root ", " └─Projection 2.00 root Column#10", " └─IndexReader 2.00 root index:Selection", @@ -6431,9 +6431,9 @@ "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " └─IndexReader(Probe) 1.25 root index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 3.75 root index:Selection", + " └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" ], "Warning": null }, @@ -6918,9 +6918,9 @@ " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " │ └─IndexReader(Probe) 1.25 root index:Selection", - " │ └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + " │ └─IndexReader(Probe) 3.75 root index:Selection", + " │ └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", " └─MaxOneRow(Probe) 1.00 root ", " └─Projection 2.00 root Column#10", " └─IndexReader 2.00 root index:Selection", @@ -6938,9 +6938,9 @@ " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " │ └─IndexReader(Probe) 1.25 root index:Selection", - " │ └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + " │ └─IndexReader(Probe) 3.75 root index:Selection", + " │ └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", " └─MaxOneRow(Probe) 1.00 root ", " └─Projection 2.00 root Column#10", " └─IndexReader 2.00 root index:Selection", @@ -6960,9 +6960,9 @@ " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " │ └─IndexReader(Probe) 1.25 root index:Selection", - " │ └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + " │ └─IndexReader(Probe) 3.75 root index:Selection", + " │ └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", " └─MaxOneRow(Probe) 1.00 root ", " └─Projection 2.00 root Column#10", " └─IndexReader 2.00 root index:Selection", @@ -6982,9 +6982,9 @@ " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " │ └─IndexReader(Probe) 1.25 root index:Selection", - " │ └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + " │ └─IndexReader(Probe) 3.75 root index:Selection", + " │ └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", " └─MaxOneRow(Probe) 1.00 root ", " └─Projection 2.00 root Column#10", " └─IndexReader 2.00 root index:Selection", @@ -7005,9 +7005,9 @@ " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " │ └─IndexReader(Probe) 1.25 root index:Selection", - " │ └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + " │ └─IndexReader(Probe) 3.75 root index:Selection", + " │ └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", " └─MaxOneRow(Probe) 1.00 root ", " └─Projection 2.00 root Column#10", " └─IndexReader 2.00 root index:Selection", @@ -7027,9 +7027,9 @@ " │ └─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " │ ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " │ └─IndexReader(Probe) 1.25 root index:Selection", - " │ └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + " │ └─IndexReader(Probe) 3.75 root index:Selection", + " │ └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", " └─MaxOneRow(Probe) 1.00 root ", " └─Projection 2.00 root Column#10", " └─IndexReader 2.00 root index:Selection", @@ -7052,15 +7052,15 @@ "│ │ │ └─TableReader 3.00 root data:Selection", "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", - "│ │ └─IndexLookUp(Probe) 1.25 root ", - "│ │ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - "│ │ │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, Column#13)], keep order:false, stats:pseudo", - "│ │ └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableRowIDScan 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ │ └─IndexLookUp(Probe) 3.00 root ", + "│ │ ├─Selection(Build) 3.00 cop[tikv] not(isnull(test.t1.a))", + "│ │ │ └─IndexRangeScan 3.01 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, Column#13)], keep order:false, stats:pseudo", + "│ │ └─Selection(Probe) 3.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableRowIDScan 3.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─IndexLookUp(Probe) 3.75 root ", + "│ ├─Selection(Build) 3.75 cop[tikv] not(isnull(test.t2.a))", + "│ │ └─IndexRangeScan 3.75 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 3.75 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader(Probe) 9990.00 root data:Selection", " └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", " └─TableFullScan 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo" @@ -7088,10 +7088,10 @@ " │ └─TableReader(Probe) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo" + " └─IndexLookUp(Probe) 4.69 root ", + " ├─Selection(Build) 4.69 cop[tikv] not(isnull(test.t2.a))", + " │ └─IndexRangeScan 4.69 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 4.69 cop[tikv] table:t2 keep order:false, stats:pseudo" ], "Warning": null }, @@ -7106,15 +7106,15 @@ "│ │ │ └─TableReader 3.00 root data:Selection", "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", - "│ │ └─IndexLookUp(Probe) 1.25 root ", - "│ │ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - "│ │ │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, Column#13)], keep order:false, stats:pseudo", - "│ │ └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableRowIDScan 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ │ └─IndexLookUp(Probe) 3.00 root ", + "│ │ ├─Selection(Build) 3.00 cop[tikv] not(isnull(test.t1.a))", + "│ │ │ └─IndexRangeScan 3.01 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, Column#13)], keep order:false, stats:pseudo", + "│ │ └─Selection(Probe) 3.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableRowIDScan 3.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─IndexLookUp(Probe) 3.75 root ", + "│ ├─Selection(Build) 3.75 cop[tikv] not(isnull(test.t2.a))", + "│ │ └─IndexRangeScan 3.75 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 3.75 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader(Probe) 9990.00 root data:Selection", " └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", " └─TableFullScan 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo" @@ -7134,15 +7134,15 @@ "│ │ │ └─TableReader 3.00 root data:Selection", "│ │ │ └─Selection 3.00 cop[tikv] not(isnull(test.t3.b))", "│ │ │ └─TableFullScan 3.00 cop[tikv] table:t3 keep order:false", - "│ │ └─IndexLookUp(Probe) 1.25 root ", - "│ │ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - "│ │ │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, Column#13)], keep order:false, stats:pseudo", - "│ │ └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.t1.b))", - "│ │ └─TableRowIDScan 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ │ └─IndexLookUp(Probe) 3.00 root ", + "│ │ ├─Selection(Build) 3.00 cop[tikv] not(isnull(test.t1.a))", + "│ │ │ └─IndexRangeScan 3.01 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, Column#13)], keep order:false, stats:pseudo", + "│ │ └─Selection(Probe) 3.00 cop[tikv] not(isnull(test.t1.b))", + "│ │ └─TableRowIDScan 3.00 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─IndexLookUp(Probe) 3.75 root ", + "│ ├─Selection(Build) 3.75 cop[tikv] not(isnull(test.t2.a))", + "│ │ └─IndexRangeScan 3.75 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 3.75 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader(Probe) 9990.00 root data:Selection", " └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", " └─TableFullScan 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo" @@ -7166,10 +7166,10 @@ "│ │ └─TableReader(Probe) 9980.01 root data:Selection", "│ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ └─IndexLookUp(Probe) 3.75 root ", + "│ ├─Selection(Build) 3.75 cop[tikv] not(isnull(test.t2.a))", + "│ │ └─IndexRangeScan 3.75 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 3.75 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader(Probe) 9990.00 root data:Selection", " └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", " └─TableFullScan 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo" @@ -7197,10 +7197,10 @@ " │ └─TableReader(Probe) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo" + " └─IndexLookUp(Probe) 4.69 root ", + " ├─Selection(Build) 4.69 cop[tikv] not(isnull(test.t2.a))", + " │ └─IndexRangeScan 4.69 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 4.69 cop[tikv] table:t2 keep order:false, stats:pseudo" ], "Warning": null }, @@ -7218,10 +7218,10 @@ "│ │ └─TableReader(Probe) 9980.01 root data:Selection", "│ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ └─IndexLookUp(Probe) 3.75 root ", + "│ ├─Selection(Build) 3.75 cop[tikv] not(isnull(test.t2.a))", + "│ │ └─IndexRangeScan 3.75 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 3.75 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader(Probe) 9990.00 root data:Selection", " └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", " └─TableFullScan 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo" @@ -7244,10 +7244,10 @@ "│ │ └─TableReader(Probe) 9980.01 root data:Selection", "│ │ └─Selection 9980.01 cop[tikv] not(isnull(test.t1.a)), not(isnull(test.t1.b))", "│ │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo", + "│ └─IndexLookUp(Probe) 3.75 root ", + "│ ├─Selection(Build) 3.75 cop[tikv] not(isnull(test.t2.a))", + "│ │ └─IndexRangeScan 3.75 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 3.75 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader(Probe) 9990.00 root data:Selection", " └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", " └─TableFullScan 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo" @@ -7273,10 +7273,10 @@ " │ └─TableReader(Probe) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t4.b))", " │ └─TableFullScan 10000.00 cop[tikv] table:t4 keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo" + " └─IndexLookUp(Probe) 5.86 root ", + " ├─Selection(Build) 5.86 cop[tikv] not(isnull(test.t2.a))", + " │ └─IndexRangeScan 5.87 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 5.86 cop[tikv] table:t2 keep order:false, stats:pseudo" ], "Warning": null }, @@ -7288,14 +7288,14 @@ "│ ├─StreamAgg(Build) 3.00 root group by:test.t3.a, funcs:firstrow(test.t3.a)->test.t3.a", "│ │ └─IndexReader 3.00 root index:IndexFullScan", "│ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:true", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo" + "│ └─IndexLookUp(Probe) 3.75 root ", + "│ ├─Selection(Build) 3.75 cop[tikv] not(isnull(test.t1.a))", + "│ │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 3.75 cop[tikv] table:t1 keep order:false, stats:pseudo", + "└─IndexLookUp(Probe) 4.69 root ", + " ├─Selection(Build) 4.69 cop[tikv] not(isnull(test.t2.a))", + " │ └─IndexRangeScan 4.69 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 4.69 cop[tikv] table:t2 keep order:false, stats:pseudo" ], "Warning": null }, @@ -7307,14 +7307,14 @@ "│ ├─StreamAgg(Build) 3.00 root group by:test.t3.a, funcs:firstrow(test.t3.a)->test.t3.a", "│ │ └─IndexReader 3.00 root index:IndexFullScan", "│ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:true", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo" + "│ └─IndexLookUp(Probe) 3.75 root ", + "│ ├─Selection(Build) 3.75 cop[tikv] not(isnull(test.t1.a))", + "│ │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 3.75 cop[tikv] table:t1 keep order:false, stats:pseudo", + "└─IndexLookUp(Probe) 4.69 root ", + " ├─Selection(Build) 4.69 cop[tikv] not(isnull(test.t2.a))", + " │ └─IndexRangeScan 4.69 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 4.69 cop[tikv] table:t2 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid" @@ -7328,14 +7328,14 @@ "│ ├─StreamAgg(Build) 3.00 root group by:test.t3.a, funcs:firstrow(test.t3.a)->test.t3.a", "│ │ └─IndexReader 3.00 root index:IndexFullScan", "│ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:true", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo" + "│ └─IndexLookUp(Probe) 3.75 root ", + "│ ├─Selection(Build) 3.75 cop[tikv] not(isnull(test.t1.a))", + "│ │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 3.75 cop[tikv] table:t1 keep order:false, stats:pseudo", + "└─IndexLookUp(Probe) 4.69 root ", + " ├─Selection(Build) 4.69 cop[tikv] not(isnull(test.t2.a))", + " │ └─IndexRangeScan 4.69 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 4.69 cop[tikv] table:t2 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid" @@ -7349,14 +7349,14 @@ "│ ├─StreamAgg(Build) 3.00 root group by:test.t3.a, funcs:firstrow(test.t3.a)->test.t3.a", "│ │ └─IndexReader 3.00 root index:IndexFullScan", "│ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:true", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo" + "│ └─IndexLookUp(Probe) 3.75 root ", + "│ ├─Selection(Build) 3.75 cop[tikv] not(isnull(test.t1.a))", + "│ │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 3.75 cop[tikv] table:t1 keep order:false, stats:pseudo", + "└─IndexLookUp(Probe) 4.69 root ", + " ├─Selection(Build) 4.69 cop[tikv] not(isnull(test.t2.a))", + " │ └─IndexRangeScan 4.69 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 4.69 cop[tikv] table:t2 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid" @@ -7370,14 +7370,14 @@ "│ ├─StreamAgg(Build) 3.00 root group by:test.t3.a, funcs:firstrow(test.t3.a)->test.t3.a", "│ │ └─IndexReader 3.00 root index:IndexFullScan", "│ │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:true", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", - "│ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t2.a))", - " │ └─IndexRangeScan 1.25 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 1.25 cop[tikv] table:t2 keep order:false, stats:pseudo" + "│ └─IndexLookUp(Probe) 3.75 root ", + "│ ├─Selection(Build) 3.75 cop[tikv] not(isnull(test.t1.a))", + "│ │ └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo", + "│ └─TableRowIDScan(Probe) 3.75 cop[tikv] table:t1 keep order:false, stats:pseudo", + "└─IndexLookUp(Probe) 4.69 root ", + " ├─Selection(Build) 4.69 cop[tikv] not(isnull(test.t2.a))", + " │ └─IndexRangeScan 4.69 cop[tikv] table:t2, index:a(a) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 4.69 cop[tikv] table:t2 keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 We can only use one leading hint at most, when multiple leading hints are used, all leading hints will be invalid" @@ -7714,9 +7714,9 @@ "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " └─IndexReader(Probe) 1.25 root index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 3.75 root index:Selection", + " └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" ], "Warning": null }, @@ -7727,9 +7727,9 @@ "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " └─IndexReader(Probe) 1.25 root index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 3.75 root index:Selection", + " └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 There are no matching table names for (t2) in optimizer hint /*+ LEADING(t1, t2) */. Maybe you can use the table alias name", @@ -7743,9 +7743,9 @@ "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " └─IndexReader(Probe) 1.25 root index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 3.75 root index:Selection", + " └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" ], "Warning": null }, @@ -7756,9 +7756,9 @@ "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " └─IndexReader(Probe) 1.25 root index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 3.75 root index:Selection", + " └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 There are no matching table names for (t2) in optimizer hint /*+ LEADING(t2, t1) */. Maybe you can use the table alias name", @@ -7772,9 +7772,9 @@ "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " └─IndexReader(Probe) 1.25 root index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 3.75 root index:Selection", + " └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 There are no matching table names for (t2) in optimizer hint /*+ LEADING(t2, t3) */. Maybe you can use the table alias name", @@ -7788,9 +7788,9 @@ "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " └─IndexReader(Probe) 1.25 root index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 3.75 root index:Selection", + " └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 There are no matching table names for (t2) in optimizer hint /*+ LEADING(t1, t2) */. Maybe you can use the table alias name", @@ -7804,9 +7804,9 @@ "└─IndexJoin 3.75 root inner join, inner:IndexReader, outer key:test.t3.a, inner key:test.t1.a, equal cond:eq(test.t3.a, test.t1.a)", " ├─IndexReader(Build) 3.00 root index:IndexFullScan", " │ └─IndexFullScan 3.00 cop[tikv] table:t3, index:a(a) keep order:false", - " └─IndexReader(Probe) 1.25 root index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 3.75 root index:Selection", + " └─Selection 3.75 cop[tikv] not(isnull(test.t1.a))", + " └─IndexRangeScan 3.75 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t3.a)], keep order:false, stats:pseudo" ], "Warning": [ "Warning 1815 There are no matching table names for (t2) in optimizer hint /*+ LEADING(t3, t2) */. Maybe you can use the table alias name", @@ -8522,11 +8522,11 @@ "│ ├─TableReader(Build) 9990.00 root data:Selection", "│ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", "│ │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - "│ └─IndexLookUp(Probe) 1.25 root ", - "│ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - "│ │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", - "│ └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.t1.b))", - "│ └─TableRowIDScan 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo", + "│ └─IndexLookUp(Probe) 12475.01 root ", + "│ ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t1.a))", + "│ │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", + "│ └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.t1.b))", + "│ └─TableRowIDScan 12487.50 cop[tikv] table:t1 keep order:false, stats:pseudo", "└─HashJoin(Probe) 12487.50 root inner join, equal:[eq(test.t2.b, test.t3.b)]", " ├─TableReader(Build) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", @@ -8570,11 +8570,11 @@ " │ ├─TableReader(Build) 9990.00 root data:Selection", " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", " │ │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " │ └─IndexLookUp(Probe) 1.25 root ", - " │ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", - " │ └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.t1.b))", - " │ └─TableRowIDScan 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo", + " │ └─IndexLookUp(Probe) 12475.01 root ", + " │ ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t1.a))", + " │ │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", + " │ └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.t1.b))", + " │ └─TableRowIDScan 12487.50 cop[tikv] table:t1 keep order:false, stats:pseudo", " └─HashJoin(Probe) 12487.50 root inner join, equal:[eq(test.t3.b, test.t2.b)]", " ├─TableReader(Build) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.b))", @@ -8821,11 +8821,11 @@ " │ ├─TableReader(Build) 9990.00 root data:Selection", " │ │ └─Selection 9990.00 cop[tikv] not(isnull(test.t.a))", " │ │ └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", - " │ └─IndexLookUp(Probe) 1.25 root ", - " │ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.t1.a))", - " │ │ └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", - " │ └─Selection(Probe) 1.25 cop[tikv] not(isnull(test.t1.b))", - " │ └─TableRowIDScan 1.25 cop[tikv] table:t1 keep order:false, stats:pseudo", + " │ └─IndexLookUp(Probe) 12475.01 root ", + " │ ├─Selection(Build) 12487.50 cop[tikv] not(isnull(test.t1.a))", + " │ │ └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:a(a) range: decided by [eq(test.t1.a, test.t.a)], keep order:false, stats:pseudo", + " │ └─Selection(Probe) 12475.01 cop[tikv] not(isnull(test.t1.b))", + " │ └─TableRowIDScan 12487.50 cop[tikv] table:t1 keep order:false, stats:pseudo", " └─HashJoin(Probe) 12487.50 root inner join, equal:[eq(test.t2.b, test.t3.b)]", " ├─TableReader(Build) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t3.b))", diff --git a/planner/core/testdata/partition_pruner_out.json b/planner/core/testdata/partition_pruner_out.json index 7692aec35cd31..b1ab71b8f8145 100644 --- a/planner/core/testdata/partition_pruner_out.json +++ b/planner/core/testdata/partition_pruner_out.json @@ -823,9 +823,9 @@ " ├─IndexReader(Build) 4.00 root partition:p0 index:Selection", " │ └─Selection 4.00 cop[tikv] not(isnull(test_partition.t6.b))", " │ └─IndexRangeScan 4.00 cop[tikv] table:t6, index:a(a, b) range:[1 1,1 1], [1 6,1 6], [2 1,2 1], [2 6,2 6], keep order:false, stats:pseudo", - " └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection", - " └─Selection 1.25 cop[tikv] in(test_partition.t5.b, 1, 6), not(isnull(test_partition.t5.b))", - " └─IndexRangeScan 625.00 cop[tikv] table:t5, index:a(a, b) range: decided by [eq(test_partition.t5.b, test_partition.t6.b) in(test_partition.t5.a, 1, 6)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 5.00 root partition:p0,p1 index:Selection", + " └─Selection 5.00 cop[tikv] in(test_partition.t5.b, 1, 6), not(isnull(test_partition.t5.b))", + " └─IndexRangeScan 2497.50 cop[tikv] table:t5, index:a(a, b) range: decided by [eq(test_partition.t5.b, test_partition.t6.b) in(test_partition.t5.a, 1, 6)], keep order:false, stats:pseudo" ] }, { @@ -839,9 +839,9 @@ " ├─IndexReader(Build) 4.00 root partition:p0 index:Selection", " │ └─Selection 4.00 cop[tikv] not(isnull(test_partition.t6.b))", " │ └─IndexRangeScan 4.00 cop[tikv] table:t6, index:a(a, b) range:[1 1,1 1], [1 6,1 6], [2 1,2 1], [2 6,2 6], keep order:false, stats:pseudo", - " └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection", - " └─Selection 1.25 cop[tikv] in(test_partition.t5.b, 1, 6), not(isnull(test_partition.t5.b))", - " └─IndexRangeScan 625.00 cop[tikv] table:t5, index:a(a, b) range: decided by [eq(test_partition.t5.b, test_partition.t6.b) in(test_partition.t5.a, 1, 6)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 5.00 root partition:p0,p1 index:Selection", + " └─Selection 5.00 cop[tikv] in(test_partition.t5.b, 1, 6), not(isnull(test_partition.t5.b))", + " └─IndexRangeScan 2497.50 cop[tikv] table:t5, index:a(a, b) range: decided by [eq(test_partition.t5.b, test_partition.t6.b) in(test_partition.t5.a, 1, 6)], keep order:false, stats:pseudo" ] }, { @@ -1651,9 +1651,9 @@ " │ └─IndexReader 159.84 root partition:p0 index:HashAgg", " │ └─HashAgg 159.84 cop[tikv] group by:test_partition_1.t2.b, ", " │ └─IndexRangeScan 199.80 cop[tikv] table:t2, index:a(a, b, id) range:[1 -inf,1 +inf], [2 -inf,2 +inf], keep order:false, stats:pseudo", - " └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test_partition_1.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t2.b)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 199.80 root partition:p0,p1 index:Selection", + " └─Selection 199.80 cop[tikv] not(isnull(test_partition_1.t1.a))", + " └─IndexRangeScan 200.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t2.b)], keep order:false, stats:pseudo" ] }, { @@ -1681,9 +1681,9 @@ " │ └─IndexReader 159.84 root partition:p0 index:HashAgg", " │ └─HashAgg 159.84 cop[tikv] group by:test_partition_1.t1.b, ", " │ └─IndexRangeScan 199.80 cop[tikv] table:t1, index:a(a, b, id) range:[1 -inf,1 +inf], [2 -inf,2 +inf], keep order:false, stats:pseudo", - " └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test_partition_1.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t1.b)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 199.80 root partition:p0,p1 index:Selection", + " └─Selection 199.80 cop[tikv] not(isnull(test_partition_1.t1.a))", + " └─IndexRangeScan 200.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t1.b)], keep order:false, stats:pseudo" ] }, { @@ -1804,9 +1804,9 @@ " ├─IndexReader(Build) 0.40 root partition:p0 index:Selection", " │ └─Selection 0.40 cop[tikv] not(isnull(test_partition_1.t2.b))", " │ └─IndexRangeScan 0.40 cop[tikv] table:t2, index:a(a, b, id) range:[1 1,1 1], [1 6,1 6], [2 1,2 1], [2 6,2 6], keep order:false, stats:pseudo", - " └─IndexReader(Probe) 0.32 root partition:p0,p1 index:Selection", - " └─Selection 0.32 cop[tikv] in(test_partition_1.t1.b, 1, 6), not(isnull(test_partition_1.t1.b))", - " └─IndexRangeScan 160.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 0.13 root partition:p0,p1 index:Selection", + " └─Selection 0.13 cop[tikv] in(test_partition_1.t1.b, 1, 6), not(isnull(test_partition_1.t1.b))", + " └─IndexRangeScan 63.94 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo" ] }, { @@ -1830,9 +1830,9 @@ " ├─IndexReader(Build) 0.40 root partition:p0 index:Selection", " │ └─Selection 0.40 cop[tikv] not(isnull(test_partition_1.t2.b))", " │ └─IndexRangeScan 0.40 cop[tikv] table:t2, index:a(a, b, id) range:[1 1,1 1], [1 6,1 6], [2 1,2 1], [2 6,2 6], keep order:false, stats:pseudo", - " └─IndexReader(Probe) 0.32 root partition:p0,p1 index:Selection", - " └─Selection 0.32 cop[tikv] in(test_partition_1.t1.b, 6, 1), not(isnull(test_partition_1.t1.b))", - " └─IndexRangeScan 160.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 0.13 root partition:p0,p1 index:Selection", + " └─Selection 0.13 cop[tikv] in(test_partition_1.t1.b, 6, 1), not(isnull(test_partition_1.t1.b))", + " └─IndexRangeScan 63.94 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo" ] }, { @@ -1856,9 +1856,9 @@ " ├─IndexReader(Build) 0.60 root partition:dual index:Selection", " │ └─Selection 0.60 cop[tikv] not(isnull(test_partition_1.t2.b))", " │ └─IndexRangeScan 0.60 cop[tikv] table:t2, index:a(a, b, id) range:[1 6,1 6], [1 9,1 9], [1 100,1 100], [2 6,2 6], [2 9,2 9], [2 100,2 100], keep order:false, stats:pseudo", - " └─IndexReader(Probe) 0.48 root partition:p1 index:Selection", - " └─Selection 0.48 cop[tikv] in(test_partition_1.t1.b, 100, 9, 6), not(isnull(test_partition_1.t1.b))", - " └─IndexRangeScan 160.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 0.29 root partition:p1 index:Selection", + " └─Selection 0.29 cop[tikv] in(test_partition_1.t1.b, 100, 9, 6), not(isnull(test_partition_1.t1.b))", + " └─IndexRangeScan 95.90 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo" ] }, { @@ -1882,9 +1882,9 @@ " ├─IndexReader(Build) 0.80 root partition:p0 index:Selection", " │ └─Selection 0.80 cop[tikv] not(isnull(test_partition_1.t2.b))", " │ └─IndexRangeScan 0.80 cop[tikv] table:t2, index:a(a, b, id) range:[1 1,1 1], [1 6,1 6], [1 9,1 9], [1 100,1 100], [2 1,2 1], [2 6,2 6], [2 9,2 9], [2 100,2 100], keep order:false, stats:pseudo", - " └─IndexReader(Probe) 0.64 root partition:p0,p1 index:Selection", - " └─Selection 0.64 cop[tikv] in(test_partition_1.t1.b, 100, 9, 6, 1), not(isnull(test_partition_1.t1.b))", - " └─IndexRangeScan 160.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 0.51 root partition:p0,p1 index:Selection", + " └─Selection 0.51 cop[tikv] in(test_partition_1.t1.b, 100, 9, 6, 1), not(isnull(test_partition_1.t1.b))", + " └─IndexRangeScan 127.87 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo" ] }, { @@ -2670,9 +2670,9 @@ " │ └─HashAgg 199.80 cop[tikv] group by:test_partition_1.t2.b, ", " │ └─Selection 249.75 cop[tikv] not(isnull(test_partition_1.t2.b))", " │ └─IndexRangeScan 250.00 cop[tikv] table:t2, index:a(a, b, id) range:[1,2], keep order:false, stats:pseudo", - " └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test_partition_1.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t2.b)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 249.75 root partition:p0,p1 index:Selection", + " └─Selection 249.75 cop[tikv] not(isnull(test_partition_1.t1.a))", + " └─IndexRangeScan 250.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t2.b)], keep order:false, stats:pseudo" ] }, { @@ -2701,9 +2701,9 @@ " │ └─HashAgg 199.80 cop[tikv] group by:test_partition_1.t1.b, ", " │ └─Selection 249.75 cop[tikv] not(isnull(test_partition_1.t1.b))", " │ └─IndexRangeScan 250.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,2], keep order:false, stats:pseudo", - " └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection", - " └─Selection 1.25 cop[tikv] not(isnull(test_partition_1.t1.a))", - " └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t1.b)], keep order:false, stats:pseudo" + " └─IndexReader(Probe) 249.75 root partition:p0,p1 index:Selection", + " └─Selection 249.75 cop[tikv] not(isnull(test_partition_1.t1.a))", + " └─IndexRangeScan 250.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t1.b)], keep order:false, stats:pseudo" ] }, { diff --git a/planner/core/testdata/plan_normalized_suite_out.json b/planner/core/testdata/plan_normalized_suite_out.json index 7acfd3c2858c1..0fc4fba15e766 100644 --- a/planner/core/testdata/plan_normalized_suite_out.json +++ b/planner/core/testdata/plan_normalized_suite_out.json @@ -56,7 +56,7 @@ "Plan": [ " Projection root test.t1.a, test.t1.b, test.t1.c", " └─Apply root semi join, equal:eq(?, ?)", - " ├─Projection root cast(test.t1.a, decimal(20,0) BINARY), test.t1.a, test.t1.b, test.t1.c", + " ├─Projection root cast(test.t1.a, decimal(10,0) BINARY), test.t1.a, test.t1.b, test.t1.c", " │ └─TableReader root ", " │ └─Selection cop gt(test.t1.b, ?)", " │ └─TableFullScan cop table:t1, range:[?,?], keep order:false", diff --git a/planner/core/testdata/plan_suite_out.json b/planner/core/testdata/plan_suite_out.json index 18e4396e16de6..c00c0671633c2 100644 --- a/planner/core/testdata/plan_suite_out.json +++ b/planner/core/testdata/plan_suite_out.json @@ -1403,9 +1403,9 @@ "├─UnionScan(Build) 10000.00 root ", "│ └─TableReader 10000.00 root data:TableFullScan", "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─UnionScan(Probe) 1.00 root ", - " └─TableReader 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [test.t.a], keep order:false, stats:pseudo" + "└─UnionScan(Probe) 10000.00 root ", + " └─TableReader 10000.00 root data:TableRangeScan", + " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [test.t.a], keep order:false, stats:pseudo" ] }, { @@ -2889,8 +2889,8 @@ "IndexMergeJoin 12500.00 root left outer join, inner:TableReader, outer key:test.t1.a, inner key:test.t2.a, other cond:eq(test.t1.b, test.t2.b)", "├─TableReader(Build) 10000.00 root data:TableFullScan", "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─TableReader(Probe) 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [test.t1.a], keep order:true, stats:pseudo" + "└─TableReader(Probe) 10000.00 root data:TableRangeScan", + " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [test.t1.a], keep order:true, stats:pseudo" ], "Result": [ "1 1", @@ -2903,8 +2903,8 @@ "IndexHashJoin 12500.00 root left outer join, inner:TableReader, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a), eq(test.t1.b, test.t2.b)", "├─TableReader(Build) 10000.00 root data:TableFullScan", "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─TableReader(Probe) 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [test.t1.a], keep order:false, stats:pseudo" + "└─TableReader(Probe) 10000.00 root data:TableRangeScan", + " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [test.t1.a], keep order:false, stats:pseudo" ], "Result": [ "1 1", @@ -2917,8 +2917,8 @@ "IndexJoin 12500.00 root left outer join, inner:TableReader, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a), eq(test.t1.b, test.t2.b)", "├─TableReader(Build) 10000.00 root data:TableFullScan", "│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - "└─TableReader(Probe) 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [test.t1.a], keep order:false, stats:pseudo" + "└─TableReader(Probe) 10000.00 root data:TableRangeScan", + " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [test.t1.a], keep order:false, stats:pseudo" ], "Result": [ "1 1", @@ -2965,12 +2965,12 @@ " ├─TableReader(Build) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.a))", " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─Selection(Probe) 0.80 root not(isnull(test.t1.a))", - " └─MaxOneRow 1.00 root ", - " └─IndexLookUp 0.00 root ", - " ├─IndexRangeScan(Build) 1.00 cop[tikv] table:t1, index:idx_a(a) range:[NULL,NULL], keep order:false, stats:pseudo", - " └─Selection(Probe) 0.00 cop[tikv] eq(test.t1.b, test.t2.b)", - " └─TableRowIDScan 1.00 cop[tikv] table:t1 keep order:false, stats:pseudo" + " └─Selection(Probe) 7992.00 root not(isnull(test.t1.a))", + " └─MaxOneRow 9990.00 root ", + " └─IndexLookUp 9.99 root ", + " ├─IndexRangeScan(Build) 9990.00 cop[tikv] table:t1, index:idx_a(a) range:[NULL,NULL], keep order:false, stats:pseudo", + " └─Selection(Probe) 9.99 cop[tikv] eq(test.t1.b, test.t2.b)", + " └─TableRowIDScan 9990.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Result": null }, @@ -2982,10 +2982,10 @@ " ├─TableReader(Build) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t2.a))", " │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", - " └─Selection(Probe) 0.80 root not(isnull(test.t3.a))", - " └─MaxOneRow 1.00 root ", - " └─IndexReader 2.00 root index:IndexRangeScan", - " └─IndexRangeScan 2.00 cop[tikv] table:t3, index:idx_abc(a, b, c) range: decided by [eq(test.t3.a, test.t2.a)], keep order:false, stats:pseudo" + " └─Selection(Probe) 7992.00 root not(isnull(test.t3.a))", + " └─MaxOneRow 9990.00 root ", + " └─IndexReader 19980.00 root index:IndexRangeScan", + " └─IndexRangeScan 19980.00 cop[tikv] table:t3, index:idx_abc(a, b, c) range: decided by [eq(test.t3.a, test.t2.a)], keep order:false, stats:pseudo" ], "Result": null } @@ -5781,9 +5781,9 @@ " ├─TableReader(Build) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.t1.a))", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─TableReader(Probe) 9.99 root data:Selection", - " └─Selection 9.99 cop[tikv] not(isnull(test.t2.b))", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" + " └─TableReader(Probe) 99800.10 root data:Selection", + " └─Selection 99800.10 cop[tikv] not(isnull(test.t2.b))", + " └─TableRangeScan 9990.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" ], "Result": [ "1" @@ -5814,8 +5814,8 @@ " └─Apply 10000.00 root CARTESIAN left outer semi join, other cond:eq(test.t1.a, test.t2.b)", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─TableReader(Probe) 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" + " └─TableReader(Probe) 10000.00 root data:TableRangeScan", + " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" ], "Result": [ "1" @@ -5829,10 +5829,10 @@ "└─Apply 10000.00 root CARTESIAN inner join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─StreamAgg(Probe) 1.00 root funcs:max(Column#14)->Column#8, funcs:count(distinct Column#15)->Column#9, funcs:sum(Column#16)->Column#10, funcs:count(1)->Column#11", - " └─Projection 1.00 root test.t2.b, test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#16", - " └─TableReader 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" + " └─StreamAgg(Probe) 10000.00 root funcs:max(Column#14)->Column#8, funcs:count(distinct Column#15)->Column#9, funcs:sum(Column#16)->Column#10, funcs:count(1)->Column#11", + " └─Projection 10000.00 root test.t2.b, test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#16", + " └─TableReader 10000.00 root data:TableRangeScan", + " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" ], "Result": [ "1 0", @@ -5847,10 +5847,10 @@ "└─Apply 10000.00 root CARTESIAN inner join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─StreamAgg(Probe) 1.00 root funcs:max(Column#14)->Column#8, funcs:count(distinct Column#15)->Column#9, funcs:sum(Column#16)->Column#10, funcs:count(1)->Column#11", - " └─Projection 1.00 root test.t2.b, test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#16", - " └─TableReader 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" + " └─StreamAgg(Probe) 10000.00 root funcs:max(Column#14)->Column#8, funcs:count(distinct Column#15)->Column#9, funcs:sum(Column#16)->Column#10, funcs:count(1)->Column#11", + " └─Projection 10000.00 root test.t2.b, test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#16", + " └─TableReader 10000.00 root data:TableRangeScan", + " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" ], "Result": [ "1 0", @@ -5865,10 +5865,10 @@ "└─Apply 10000.00 root CARTESIAN inner join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─StreamAgg(Probe) 1.00 root funcs:max(Column#19)->Column#8, funcs:sum(Column#20)->Column#9, funcs:count(1)->Column#10", - " └─Projection 1.00 root test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#20", - " └─TableReader 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" + " └─StreamAgg(Probe) 10000.00 root funcs:max(Column#19)->Column#8, funcs:sum(Column#20)->Column#9, funcs:count(1)->Column#10", + " └─Projection 10000.00 root test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#20", + " └─TableReader 10000.00 root data:TableRangeScan", + " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" ], "Result": [ "1 0", @@ -5883,10 +5883,10 @@ "└─Apply 10000.00 root CARTESIAN inner join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─StreamAgg(Probe) 1.00 root funcs:max(Column#19)->Column#8, funcs:sum(Column#20)->Column#9, funcs:count(1)->Column#10", - " └─Projection 1.00 root test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#20", - " └─TableReader 1.00 root data:TableRangeScan", - " └─TableRangeScan 1.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" + " └─StreamAgg(Probe) 10000.00 root funcs:max(Column#19)->Column#8, funcs:sum(Column#20)->Column#9, funcs:count(1)->Column#10", + " └─Projection 10000.00 root test.t2.b, cast(isnull(test.t2.b), decimal(20,0) BINARY)->Column#20", + " └─TableReader 10000.00 root data:TableRangeScan", + " └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" ], "Result": [ "1 0", @@ -5916,9 +5916,9 @@ "└─Apply 10000.00 root CARTESIAN left outer join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─MaxOneRow(Probe) 1.00 root ", - " └─TableReader 0.20 root data:TableRangeScan", - " └─TableRangeScan 0.20 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" + " └─MaxOneRow(Probe) 10000.00 root ", + " └─TableReader 2000.00 root data:TableRangeScan", + " └─TableRangeScan 2000.00 cop[tikv] table:t2 range: decided by [eq(test.t2.a, test.t1.b)], keep order:false, stats:pseudo" ], "Result": [ "1 1", @@ -5980,11 +5980,11 @@ "└─Apply 10000.00 root CARTESIAN left outer semi join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─Limit(Probe) 2.00 root offset:0, count:2", - " └─TableReader 2.00 root data:Limit", - " └─Limit 2.00 cop[tikv] offset:0, count:2", - " └─Selection 2.00 cop[tikv] eq(test.t3.a, test.t1.b)", - " └─TableFullScan 2000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" + " └─Limit(Probe) 20000.00 root offset:0, count:2", + " └─TableReader 20000.00 root data:Limit", + " └─Limit 20000.00 cop[tikv] offset:0, count:2", + " └─Selection 20000.00 cop[tikv] eq(test.t3.a, test.t1.b)", + " └─TableFullScan 20000000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" ], "Result": [ "1", @@ -6052,12 +6052,12 @@ "└─Apply 10000.00 root CARTESIAN left outer join", " ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", - " └─MaxOneRow(Probe) 1.00 root ", - " └─StreamAgg 1.00 root funcs:count(Column#12)->Column#10", - " └─TableReader 1.00 root data:StreamAgg", - " └─StreamAgg 1.00 cop[tikv] funcs:count(test.t3.a)->Column#12", - " └─Selection 10.00 cop[tikv] eq(test.t3.b, test.t1.b)", - " └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" + " └─MaxOneRow(Probe) 10000.00 root ", + " └─StreamAgg 10000.00 root funcs:count(Column#12)->Column#10", + " └─TableReader 10000.00 root data:StreamAgg", + " └─StreamAgg 10000.00 cop[tikv] funcs:count(test.t3.a)->Column#12", + " └─Selection 100000.00 cop[tikv] eq(test.t3.b, test.t1.b)", + " └─TableFullScan 100000000.00 cop[tikv] table:t3 keep order:false, stats:pseudo" ], "Result": [ "0", @@ -6089,12 +6089,12 @@ " ├─IndexLookUp(Build) 250.00 root ", " │ ├─IndexRangeScan(Build) 250.00 cop[tikv] table:ta, index:idx_ta_name(name) range:[\"chad999\",\"chad99:\"), keep order:false, stats:pseudo", " │ └─TableRowIDScan(Probe) 250.00 cop[tikv] table:ta keep order:false, stats:pseudo", - " └─MaxOneRow(Probe) 1.00 root ", - " └─StreamAgg 1.00 root funcs:sum(Column#21)->Column#13", - " └─Projection 10.00 root cast(test.tb.code, decimal(10,0) BINARY)->Column#21", - " └─IndexLookUp 10.00 root ", - " ├─IndexRangeScan(Build) 10.00 cop[tikv] table:tb, index:idx_tb_id(id) range: decided by [eq(test.ta.id, test.tb.id)], keep order:false, stats:pseudo", - " └─TableRowIDScan(Probe) 10.00 cop[tikv] table:tb keep order:false, stats:pseudo" + " └─MaxOneRow(Probe) 250.00 root ", + " └─StreamAgg 250.00 root funcs:sum(Column#21)->Column#13", + " └─Projection 2500.00 root cast(test.tb.code, decimal(10,0) BINARY)->Column#21", + " └─IndexLookUp 2500.00 root ", + " ├─IndexRangeScan(Build) 2500.00 cop[tikv] table:tb, index:idx_tb_id(id) range: decided by [eq(test.ta.id, test.tb.id)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 2500.00 cop[tikv] table:tb keep order:false, stats:pseudo" ], "Result": null, "Warning": null @@ -6127,19 +6127,19 @@ " ├─IndexLookUp(Build) 250.00 root ", " │ ├─IndexRangeScan(Build) 250.00 cop[tikv] table:ta, index:idx_ta_name(name) range:[\"chad999\",\"chad99:\"), keep order:false, stats:pseudo", " │ └─TableRowIDScan(Probe) 250.00 cop[tikv] table:ta keep order:false, stats:pseudo", - " └─MaxOneRow(Probe) 1.00 root ", - " └─StreamAgg 1.00 root funcs:sum(Column#33)->Column#18", - " └─Projection 7.99 root cast(test.tb.code, decimal(10,0) BINARY)->Column#33", - " └─IndexJoin 7.99 root semi join, inner:IndexLookUp, outer key:test.tb.name, inner key:test.tc.name, equal cond:eq(test.tb.name, test.tc.name)", - " ├─IndexLookUp(Build) 9.99 root ", - " │ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:tb, index:idx_tb_id(id) range: decided by [eq(test.ta.id, test.tb.id)], keep order:false, stats:pseudo", - " │ └─Selection(Probe) 9.99 cop[tikv] not(isnull(test.tb.name))", - " │ └─TableRowIDScan 10.00 cop[tikv] table:tb keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 1.25 root ", - " ├─Selection(Build) 1.56 cop[tikv] not(isnull(test.tc.name))", - " │ └─IndexRangeScan 1.56 cop[tikv] table:tc, index:idx_tc_name(name) range: decided by [eq(test.tc.name, test.tb.name)], keep order:false, stats:pseudo", - " └─Selection(Probe) 1.25 cop[tikv] like(cast(test.tc.code, var_string(20)), \"999%\", 92)", - " └─TableRowIDScan 1.56 cop[tikv] table:tc keep order:false, stats:pseudo" + " └─MaxOneRow(Probe) 250.00 root ", + " └─StreamAgg 250.00 root funcs:sum(Column#33)->Column#18", + " └─Projection 1998.00 root cast(test.tb.code, decimal(10,0) BINARY)->Column#33", + " └─IndexJoin 1998.00 root semi join, inner:IndexLookUp, outer key:test.tb.name, inner key:test.tc.name, equal cond:eq(test.tb.name, test.tc.name)", + " ├─IndexLookUp(Build) 2497.50 root ", + " │ ├─IndexRangeScan(Build) 2500.00 cop[tikv] table:tb, index:idx_tb_id(id) range: decided by [eq(test.ta.id, test.tb.id)], keep order:false, stats:pseudo", + " │ └─Selection(Probe) 2497.50 cop[tikv] not(isnull(test.tb.name))", + " │ └─TableRowIDScan 2500.00 cop[tikv] table:tb keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 3121.87 root ", + " ├─Selection(Build) 3902.34 cop[tikv] not(isnull(test.tc.name))", + " │ └─IndexRangeScan 3906.25 cop[tikv] table:tc, index:idx_tc_name(name) range: decided by [eq(test.tc.name, test.tb.name)], keep order:false, stats:pseudo", + " └─Selection(Probe) 3121.87 cop[tikv] like(cast(test.tc.code, var_string(20)), \"999%\", 92)", + " └─TableRowIDScan 3902.34 cop[tikv] table:tc keep order:false, stats:pseudo" ], "Result": null, "Warning": null @@ -6157,10 +6157,10 @@ " ├─TableReader(Build) 9990.00 root data:Selection", " │ └─Selection 9990.00 cop[tikv] not(isnull(test.tb.id))", " │ └─TableFullScan 10000.00 cop[tikv] table:tb keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 8.00 root ", - " ├─IndexRangeScan(Build) 10.00 cop[tikv] table:tc, index:idx_tc_name(name) range: decided by [eq(test.tb.name, test.tc.name)], keep order:false, stats:pseudo", - " └─Selection(Probe) 8.00 cop[tikv] like(cast(test.tc.code, var_string(20)), \"999%\", 92)", - " └─TableRowIDScan 10.00 cop[tikv] table:tc keep order:false, stats:pseudo" + " └─IndexLookUp(Probe) 79920.00 root ", + " ├─IndexRangeScan(Build) 99900.00 cop[tikv] table:tc, index:idx_tc_name(name) range: decided by [eq(test.tb.name, test.tc.name)], keep order:false, stats:pseudo", + " └─Selection(Probe) 79920.00 cop[tikv] like(cast(test.tc.code, var_string(20)), \"999%\", 92)", + " └─TableRowIDScan 99900.00 cop[tikv] table:tc keep order:false, stats:pseudo" ], "Result": null, "Warning": null @@ -6173,17 +6173,17 @@ " ├─IndexLookUp(Build) 250.00 root ", " │ ├─IndexRangeScan(Build) 250.00 cop[tikv] table:ta, index:idx_ta_name(name) range:[\"chad999\",\"chad99:\"), keep order:false, stats:pseudo", " │ └─TableRowIDScan(Probe) 250.00 cop[tikv] table:ta keep order:false, stats:pseudo", - " └─MaxOneRow(Probe) 1.00 root ", - " └─StreamAgg 1.00 root funcs:sum(Column#22)->Column#18", - " └─Projection 10.00 root cast(test.tb.code, decimal(10,0) BINARY)->Column#22", - " └─Apply 10.00 root CARTESIAN semi join", - " ├─IndexLookUp(Build) 10.00 root ", - " │ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:tb, index:idx_tb_id(id) range: decided by [eq(test.ta.id, test.tb.id)], keep order:false, stats:pseudo", - " │ └─TableRowIDScan(Probe) 10.00 cop[tikv] table:tb keep order:false, stats:pseudo", - " └─IndexLookUp(Probe) 8.00 root ", - " ├─IndexRangeScan(Build) 10.00 cop[tikv] table:tc, index:idx_tc_name(name) range: decided by [eq(test.tb.name, test.tc.name)], keep order:false, stats:pseudo", - " └─Selection(Probe) 8.00 cop[tikv] like(cast(test.tc.code, var_string(20)), \"999%\", 92)", - " └─TableRowIDScan 10.00 cop[tikv] table:tc keep order:false, stats:pseudo" + " └─MaxOneRow(Probe) 250.00 root ", + " └─StreamAgg 250.00 root funcs:sum(Column#22)->Column#18", + " └─Projection 2500.00 root cast(test.tb.code, decimal(10,0) BINARY)->Column#22", + " └─Apply 2500.00 root CARTESIAN semi join", + " ├─IndexLookUp(Build) 2500.00 root ", + " │ ├─IndexRangeScan(Build) 2500.00 cop[tikv] table:tb, index:idx_tb_id(id) range: decided by [eq(test.ta.id, test.tb.id)], keep order:false, stats:pseudo", + " │ └─TableRowIDScan(Probe) 2500.00 cop[tikv] table:tb keep order:false, stats:pseudo", + " └─IndexLookUp(Probe) 20000.00 root ", + " ├─IndexRangeScan(Build) 25000.00 cop[tikv] table:tc, index:idx_tc_name(name) range: decided by [eq(test.tb.name, test.tc.name)], keep order:false, stats:pseudo", + " └─Selection(Probe) 20000.00 cop[tikv] like(cast(test.tc.code, var_string(20)), \"999%\", 92)", + " └─TableRowIDScan 25000.00 cop[tikv] table:tc keep order:false, stats:pseudo" ], "Result": null, "Warning": null @@ -6215,15 +6215,15 @@ " ├─IndexLookUp(Build) 10.00 root ", " │ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:ta, index:idx_ta_name(name) range:[\"chad999\",\"chad999\"], keep order:false, stats:pseudo", " │ └─TableRowIDScan(Probe) 10.00 cop[tikv] table:ta keep order:false, stats:pseudo", - " └─Selection(Probe) 0.80 root gt(Column#9, 900)", - " └─MaxOneRow 1.00 root ", - " └─StreamAgg 1.00 root funcs:max(test.tb.code)->Column#9", - " └─TopN 1.00 root test.tb.code:desc, offset:0, count:1", - " └─IndexLookUp 1.00 root ", - " ├─IndexRangeScan(Build) 10.00 cop[tikv] table:tb, index:idx_tb_id(id) range: decided by [eq(test.ta.id, test.tb.id)], keep order:false, stats:pseudo", - " └─TopN(Probe) 1.00 cop[tikv] test.tb.code:desc, offset:0, count:1", - " └─Selection 9.99 cop[tikv] not(isnull(test.tb.code))", - " └─TableRowIDScan 10.00 cop[tikv] table:tb keep order:false, stats:pseudo" + " └─Selection(Probe) 8.00 root gt(Column#9, 900)", + " └─MaxOneRow 10.00 root ", + " └─StreamAgg 10.00 root funcs:max(test.tb.code)->Column#9", + " └─TopN 10.00 root test.tb.code:desc, offset:0, count:1", + " └─IndexLookUp 10.00 root ", + " ├─IndexRangeScan(Build) 100.00 cop[tikv] table:tb, index:idx_tb_id(id) range: decided by [eq(test.ta.id, test.tb.id)], keep order:false, stats:pseudo", + " └─TopN(Probe) 10.00 cop[tikv] test.tb.code:desc, offset:0, count:1", + " └─Selection 99.90 cop[tikv] not(isnull(test.tb.code))", + " └─TableRowIDScan 100.00 cop[tikv] table:tb keep order:false, stats:pseudo" ], "Result": null, "Warning": null @@ -6270,30 +6270,30 @@ " │ │ │ ├─IndexRangeScan(Build) 250.00 cop[tikv] table:tb, index:idx_tb_name(name) range:[\"chad9\",\"chad:\"), keep order:false, stats:pseudo", " │ │ │ └─Selection(Probe) 249.75 cop[tikv] not(isnull(test.tb.code))", " │ │ │ └─TableRowIDScan 250.00 cop[tikv] table:tb keep order:false, stats:pseudo", - " │ │ └─IndexLookUp(Probe) 1.25 root ", - " │ │ ├─Selection(Build) 1.25 cop[tikv] not(isnull(test.ta.code))", - " │ │ │ └─IndexRangeScan 1.25 cop[tikv] table:ta, index:idx_ta_code(code) range: decided by [eq(test.ta.code, test.tb.code)], keep order:false, stats:pseudo", - " │ │ └─TableRowIDScan(Probe) 1.25 cop[tikv] table:ta keep order:false, stats:pseudo", - " │ └─Selection(Probe) 0.80 root gt(Column#14, 100)", - " │ └─MaxOneRow 1.00 root ", - " │ └─StreamAgg 1.00 root funcs:max(test.tc.id)->Column#14", - " │ └─TopN 0.25 root test.tc.id:desc, offset:0, count:1", - " │ └─IndexLookUp 0.25 root ", - " │ ├─Selection(Build) 0.25 cop[tikv] eq(test.ta.name, test.tc.name)", - " │ │ └─IndexRangeScan 250.00 cop[tikv] table:tc, index:idx_tc_name(name) range:[\"chad99\",\"chad9:\"), keep order:false, stats:pseudo", - " │ └─TopN(Probe) 0.25 cop[tikv] test.tc.id:desc, offset:0, count:1", - " │ └─Selection 0.25 cop[tikv] not(isnull(test.tc.id))", - " │ └─TableRowIDScan 0.25 cop[tikv] table:tc keep order:false, stats:pseudo", - " └─Selection(Probe) 0.80 root gt(Column#19, 100)", - " └─MaxOneRow 1.00 root ", - " └─StreamAgg 1.00 root funcs:max(test.td.id)->Column#19", - " └─Limit 0.25 root offset:0, count:1", - " └─Projection 0.25 root test.td.id, test.td.name", - " └─IndexLookUp 0.25 root ", - " ├─Selection(Build) 9.99 cop[tikv] eq(test.ta.id, test.td.id)", - " │ └─IndexFullScan 9990.00 cop[tikv] table:td, index:idx_tc_id(id) keep order:true, desc, stats:pseudo", - " └─Selection(Probe) 0.25 cop[tikv] like(test.td.name, \"chad999%\", 92)", - " └─TableRowIDScan 9.99 cop[tikv] table:td keep order:false, stats:pseudo" + " │ │ └─IndexLookUp(Probe) 249.75 root ", + " │ │ ├─Selection(Build) 249.75 cop[tikv] not(isnull(test.ta.code))", + " │ │ │ └─IndexRangeScan 250.00 cop[tikv] table:ta, index:idx_ta_code(code) range: decided by [eq(test.ta.code, test.tb.code)], keep order:false, stats:pseudo", + " │ │ └─TableRowIDScan(Probe) 249.75 cop[tikv] table:ta keep order:false, stats:pseudo", + " │ └─Selection(Probe) 199.80 root gt(Column#14, 100)", + " │ └─MaxOneRow 249.75 root ", + " │ └─StreamAgg 249.75 root funcs:max(test.tc.id)->Column#14", + " │ └─TopN 62.38 root test.tc.id:desc, offset:0, count:1", + " │ └─IndexLookUp 62.38 root ", + " │ ├─Selection(Build) 62.44 cop[tikv] eq(test.ta.name, test.tc.name)", + " │ │ └─IndexRangeScan 62437.50 cop[tikv] table:tc, index:idx_tc_name(name) range:[\"chad99\",\"chad9:\"), keep order:false, stats:pseudo", + " │ └─TopN(Probe) 62.38 cop[tikv] test.tc.id:desc, offset:0, count:1", + " │ └─Selection 62.38 cop[tikv] not(isnull(test.tc.id))", + " │ └─TableRowIDScan 62.44 cop[tikv] table:tc keep order:false, stats:pseudo", + " └─Selection(Probe) 199.80 root gt(Column#19, 100)", + " └─MaxOneRow 249.75 root ", + " └─StreamAgg 249.75 root funcs:max(test.td.id)->Column#19", + " └─Limit 62.38 root offset:0, count:1", + " └─Projection 62.38 root test.td.id, test.td.name", + " └─IndexLookUp 62.38 root ", + " ├─Selection(Build) 2495.00 cop[tikv] eq(test.ta.id, test.td.id)", + " │ └─IndexFullScan 2495002.50 cop[tikv] table:td, index:idx_tc_id(id) keep order:true, desc, stats:pseudo", + " └─Selection(Probe) 62.38 cop[tikv] like(test.td.name, \"chad999%\", 92)", + " └─TableRowIDScan 2495.00 cop[tikv] table:td keep order:false, stats:pseudo" ], "Result": null, "Warning": null @@ -6307,30 +6307,30 @@ " │ ├─Apply(Build) 10000.00 root CARTESIAN semi join", " │ │ ├─TableReader(Build) 10000.00 root data:TableFullScan", " │ │ │ └─TableFullScan 10000.00 cop[tikv] table:ta keep order:false, stats:pseudo", - " │ │ └─IndexLookUp(Probe) 0.25 root ", - " │ │ ├─IndexRangeScan(Build) 250.00 cop[tikv] table:tb, index:idx_tb_name(name) range:[\"chad9\",\"chad:\"), keep order:false, stats:pseudo", - " │ │ └─Selection(Probe) 0.25 cop[tikv] eq(test.ta.code, test.tb.code)", - " │ │ └─TableRowIDScan 250.00 cop[tikv] table:tb keep order:false, stats:pseudo", - " │ └─Selection(Probe) 0.80 root gt(Column#14, 100)", - " │ └─MaxOneRow 1.00 root ", - " │ └─StreamAgg 1.00 root funcs:max(test.tc.id)->Column#14", - " │ └─TopN 0.25 root test.tc.id:desc, offset:0, count:1", - " │ └─IndexLookUp 0.25 root ", - " │ ├─Selection(Build) 0.25 cop[tikv] eq(test.ta.name, test.tc.name)", - " │ │ └─IndexRangeScan 250.00 cop[tikv] table:tc, index:idx_tc_name(name) range:[\"chad99\",\"chad9:\"), keep order:false, stats:pseudo", - " │ └─TopN(Probe) 0.25 cop[tikv] test.tc.id:desc, offset:0, count:1", - " │ └─Selection 0.25 cop[tikv] not(isnull(test.tc.id))", - " │ └─TableRowIDScan 0.25 cop[tikv] table:tc keep order:false, stats:pseudo", - " └─Selection(Probe) 0.80 root gt(Column#19, 100)", - " └─MaxOneRow 1.00 root ", - " └─StreamAgg 1.00 root funcs:max(test.td.id)->Column#19", - " └─Limit 0.25 root offset:0, count:1", - " └─Projection 0.25 root test.td.id, test.td.name", - " └─IndexLookUp 0.25 root ", - " ├─Selection(Build) 9.99 cop[tikv] eq(test.ta.id, test.td.id)", - " │ └─IndexFullScan 9990.00 cop[tikv] table:td, index:idx_tc_id(id) keep order:true, desc, stats:pseudo", - " └─Selection(Probe) 0.25 cop[tikv] like(test.td.name, \"chad999%\", 92)", - " └─TableRowIDScan 9.99 cop[tikv] table:td keep order:false, stats:pseudo" + " │ │ └─IndexLookUp(Probe) 2500.00 root ", + " │ │ ├─IndexRangeScan(Build) 2500000.00 cop[tikv] table:tb, index:idx_tb_name(name) range:[\"chad9\",\"chad:\"), keep order:false, stats:pseudo", + " │ │ └─Selection(Probe) 2500.00 cop[tikv] eq(test.ta.code, test.tb.code)", + " │ │ └─TableRowIDScan 2500000.00 cop[tikv] table:tb keep order:false, stats:pseudo", + " │ └─Selection(Probe) 8000.00 root gt(Column#14, 100)", + " │ └─MaxOneRow 10000.00 root ", + " │ └─StreamAgg 10000.00 root funcs:max(test.tc.id)->Column#14", + " │ └─TopN 2497.50 root test.tc.id:desc, offset:0, count:1", + " │ └─IndexLookUp 2497.50 root ", + " │ ├─Selection(Build) 2500.00 cop[tikv] eq(test.ta.name, test.tc.name)", + " │ │ └─IndexRangeScan 2500000.00 cop[tikv] table:tc, index:idx_tc_name(name) range:[\"chad99\",\"chad9:\"), keep order:false, stats:pseudo", + " │ └─TopN(Probe) 2497.50 cop[tikv] test.tc.id:desc, offset:0, count:1", + " │ └─Selection 2497.50 cop[tikv] not(isnull(test.tc.id))", + " │ └─TableRowIDScan 2500.00 cop[tikv] table:tc keep order:false, stats:pseudo", + " └─Selection(Probe) 8000.00 root gt(Column#19, 100)", + " └─MaxOneRow 10000.00 root ", + " └─StreamAgg 10000.00 root funcs:max(test.td.id)->Column#19", + " └─Limit 2497.50 root offset:0, count:1", + " └─Projection 2497.50 root test.td.id, test.td.name", + " └─IndexLookUp 2497.50 root ", + " ├─Selection(Build) 99900.00 cop[tikv] eq(test.ta.id, test.td.id)", + " │ └─IndexFullScan 99900000.00 cop[tikv] table:td, index:idx_tc_id(id) keep order:true, desc, stats:pseudo", + " └─Selection(Probe) 2497.50 cop[tikv] like(test.td.name, \"chad999%\", 92)", + " └─TableRowIDScan 99900.00 cop[tikv] table:td keep order:false, stats:pseudo" ], "Result": null, "Warning": null diff --git a/planner/core/testdata/stats_suite_out.json b/planner/core/testdata/stats_suite_out.json index 26f0f2fe5a193..2fcc3c6518425 100644 --- a/planner/core/testdata/stats_suite_out.json +++ b/planner/core/testdata/stats_suite_out.json @@ -184,9 +184,9 @@ " └─Apply 4.00 root CARTESIAN left outer join", " ├─IndexReader(Build) 4.00 root index:IndexFullScan", " │ └─IndexFullScan 4.00 cop[tikv] table:t1, index:a(a, b) keep order:true", - " └─MaxOneRow(Probe) 1.00 root ", - " └─IndexReader 2.00 root index:IndexRangeScan", - " └─IndexRangeScan 2.00 cop[tikv] table:t2, index:a(a, b) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false" + " └─MaxOneRow(Probe) 4.00 root ", + " └─IndexReader 8.00 root index:IndexRangeScan", + " └─IndexRangeScan 8.00 cop[tikv] table:t2, index:a(a, b) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false" ] }, { @@ -196,10 +196,10 @@ "└─Apply 4.00 root left outer semi join, equal:[eq(test.t1.b, test.t2.b)]", " ├─IndexReader(Build) 4.00 root index:IndexFullScan", " │ └─IndexFullScan 4.00 cop[tikv] table:t1, index:a(a, b) keep order:true", - " └─Limit(Probe) 3.00 root offset:0, count:3", - " └─IndexReader 3.00 root index:Limit", - " └─Limit 3.00 cop[tikv] offset:0, count:3", - " └─IndexRangeScan 3.00 cop[tikv] table:t2, index:a(a, b) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false" + " └─Limit(Probe) 12.00 root offset:0, count:3", + " └─IndexReader 12.00 root index:Limit", + " └─Limit 12.00 cop[tikv] offset:0, count:3", + " └─IndexRangeScan 12.00 cop[tikv] table:t2, index:a(a, b) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false" ] }, { @@ -209,10 +209,10 @@ "└─Apply 4.00 root anti left outer semi join, equal:[eq(test.t1.b, test.t2.b)]", " ├─IndexReader(Build) 4.00 root index:IndexFullScan", " │ └─IndexFullScan 4.00 cop[tikv] table:t1, index:a(a, b) keep order:true", - " └─Limit(Probe) 3.00 root offset:0, count:3", - " └─IndexReader 3.00 root index:Limit", - " └─Limit 3.00 cop[tikv] offset:0, count:3", - " └─IndexRangeScan 3.00 cop[tikv] table:t2, index:a(a, b) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false" + " └─Limit(Probe) 12.00 root offset:0, count:3", + " └─IndexReader 12.00 root index:Limit", + " └─Limit 12.00 cop[tikv] offset:0, count:3", + " └─IndexRangeScan 12.00 cop[tikv] table:t2, index:a(a, b) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false" ] }, { diff --git a/util/ranger/testdata/ranger_suite_out.json b/util/ranger/testdata/ranger_suite_out.json index f9d4ede451753..174731cac0827 100644 --- a/util/ranger/testdata/ranger_suite_out.json +++ b/util/ranger/testdata/ranger_suite_out.json @@ -9,12 +9,12 @@ "└─Apply 2.00 root CARTESIAN left outer semi join, other cond:eq(test.t.e, Column#26)", " ├─TableReader(Build) 2.00 root data:TableFullScan", " │ └─TableFullScan 2.00 cop[tikv] table:t keep order:false", - " └─StreamAgg(Probe) 1.00 root funcs:count(1)->Column#26", - " └─HashJoin 2.00 root inner join, equal:[eq(test.t.a, test.t.a)]", - " ├─TableReader(Build) 2.00 root data:TableFullScan", - " │ └─TableFullScan 2.00 cop[tikv] table:t1 keep order:false", - " └─IndexReader(Probe) 2.00 root index:IndexRangeScan", - " └─IndexRangeScan 2.00 cop[tikv] table:s, index:idx(b, c, d) range: decided by [eq(test.t.b, 1) in(test.t.c, 1, 2) eq(test.t.d, test.t.a)], keep order:false" + " └─StreamAgg(Probe) 2.00 root funcs:count(1)->Column#26", + " └─HashJoin 4.00 root inner join, equal:[eq(test.t.a, test.t.a)]", + " ├─TableReader(Build) 4.00 root data:TableFullScan", + " │ └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false", + " └─IndexReader(Probe) 4.00 root index:IndexRangeScan", + " └─IndexRangeScan 4.00 cop[tikv] table:s, index:idx(b, c, d) range: decided by [eq(test.t.b, 1) in(test.t.c, 1, 2) eq(test.t.d, test.t.a)], keep order:false" ] }, {