enable prune unstable path for table use default statistics
This commit is contained in:
parent
939a180f2f
commit
428577024b
@ -5792,8 +5792,7 @@ int ObJoinOrder::pruning_unstable_access_path(BaseTableOptInfo *table_opt_info,
|
||||
OB_ISNULL(session_info = get_plan()->get_optimizer_context().get_session_info())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected null", K(ret), K(access_paths.count()), K(get_plan()), K(session_info));
|
||||
} else if (access_paths.count() <= 1 ||
|
||||
OB_DEFAULT_STAT_EST == table_meta_info_.cost_est_type_) {
|
||||
} else if (access_paths.count() <= 1) {
|
||||
/* do not pruning access path */
|
||||
} else if (OB_FAIL(try_pruning_base_table_access_path(access_paths, unstable_index_id))) {
|
||||
LOG_WARN("failed to pruning base table access path", K(ret));
|
||||
|
@ -37,107 +37,107 @@ Outputs & filters:
|
||||
|
||||
explain select * from t1 where c1 = 1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
=====================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
-------------------------------------
|
||||
|0 |TABLE SCAN|t1(k1)|1 |5 |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter([t1.c1 = 1]), rowset=256,
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter(nil), rowset=256,
|
||||
access([t1.__pk_increment], [t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
|
||||
explain select * from t1 where c1 < 1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
=====================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
-------------------------------------
|
||||
|0 |TABLE SCAN|t1(k1)|1 |5 |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter([t1.c1 < 1]), rowset=256,
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter(nil), rowset=256,
|
||||
access([t1.__pk_increment], [t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
|
||||
explain select * from t1 where c1 > 1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
=====================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
-------------------------------------
|
||||
|0 |TABLE SCAN|t1(k1)|1 |5 |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter([t1.c1 > 1]), rowset=256,
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter(nil), rowset=256,
|
||||
access([t1.__pk_increment], [t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
|
||||
explain select * from t1 where c1 > 1 and c1 < 10;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
=====================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
-------------------------------------
|
||||
|0 |TABLE SCAN|t1(k1)|1 |5 |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter([t1.c1 > 1], [t1.c1 < 10]), rowset=256,
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter(nil), rowset=256,
|
||||
access([t1.__pk_increment], [t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
|
||||
explain select * from t1 where c1 = 1 and c2 < 1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
=====================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
-------------------------------------
|
||||
|0 |TABLE SCAN|t1(k2)|1 |5 |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter([t1.c2 < 1], [t1.c1 = 1]), rowset=256,
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter(nil), rowset=256,
|
||||
access([t1.__pk_increment], [t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
|
||||
explain select * from t1 where c1 = 1 and c2 = 1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
=====================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
-------------------------------------
|
||||
|0 |TABLE SCAN|t1(k2)|1 |5 |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter([t1.c1 = 1], [t1.c2 = 1]), rowset=256,
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter(nil), rowset=256,
|
||||
access([t1.__pk_increment], [t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
|
||||
explain select * from t1 where c1 = 1 and c2 = 1 and c3 < 1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
=====================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
-------------------------------------
|
||||
|0 |TABLE SCAN|t1(k3)|1 |5 |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter([t1.c3 < 1], [t1.c1 = 1], [t1.c2 = 1]), rowset=256,
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter(nil), rowset=256,
|
||||
access([t1.__pk_increment], [t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
|
||||
explain select * from t1 where c1 = 1 and c2 = 1 and c3 = 1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |3 |
|
||||
===================================
|
||||
=====================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
-------------------------------------
|
||||
|0 |TABLE SCAN|t1(k3)|1 |5 |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter([t1.c1 = 1], [t1.c2 = 1], [t1.c3 = 1]), rowset=256,
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), filter(nil), rowset=256,
|
||||
access([t1.__pk_increment], [t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10]), partitions(p0)
|
||||
|
||||
explain select count(*) from t2;
|
||||
Query Plan
|
||||
|
@ -247,13 +247,13 @@ Outputs & filters:
|
||||
|
||||
explain select distinct(c),b, d from t1 where b > 200 limit 100;
|
||||
Query Plan
|
||||
=======================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
---------------------------------------
|
||||
|0 |LIMIT | |1 |3 |
|
||||
|1 | HASH DISTINCT| |1 |3 |
|
||||
|2 | TABLE SCAN |t1 |1 |2 |
|
||||
=======================================
|
||||
================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
------------------------------------------------
|
||||
|0 |LIMIT | |1 |5 |
|
||||
|1 | HASH DISTINCT| |1 |5 |
|
||||
|2 | TABLE SCAN |t1(idx_c_a_b)|1 |5 |
|
||||
================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
@ -261,7 +261,7 @@ Outputs & filters:
|
||||
1 - output([t1.c], [t1.b], [t1.d]), filter(nil), rowset=256,
|
||||
distinct([t1.c], [t1.b], [t1.d])
|
||||
2 - output([t1.b], [t1.c], [t1.d]), filter([t1.b > 200]), rowset=256,
|
||||
access([t1.b], [t1.c], [t1.d]), partitions(p0)
|
||||
access([t1.pk1], [t1.b], [t1.c], [t1.d]), partitions(p0)
|
||||
|
||||
explain select b from t1 order by b;
|
||||
Query Plan
|
||||
@ -2966,16 +2966,16 @@ Outputs & filters:
|
||||
|
||||
explain select * from t7 where a >= 0 and a <= 5 and b = 1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t7 |1 |2 |
|
||||
===================================
|
||||
=====================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
-------------------------------------
|
||||
|0 |TABLE SCAN|t7(k1)|1 |5 |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t7.a], [t7.b], [t7.c], [t7.d], [t7.e], [t7.f]), filter([t7.a >= 0], [t7.a <= 5], [t7.b = 1]), rowset=256,
|
||||
access([t7.a], [t7.b], [t7.c], [t7.d], [t7.e], [t7.f]), partitions(p0)
|
||||
0 - output([t7.a], [t7.b], [t7.c], [t7.d], [t7.e], [t7.f]), filter([t7.b = 1]), rowset=256,
|
||||
access([t7.__pk_increment], [t7.a], [t7.b], [t7.c], [t7.d], [t7.e], [t7.f]), partitions(p0)
|
||||
|
||||
explain select * from t8 where e = 1 order by b;
|
||||
Query Plan
|
||||
|
@ -3521,9 +3521,9 @@ Query Plan
|
||||
==================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
--------------------------------------------------
|
||||
|0 |SCALAR GROUP BY | |1 |4 |
|
||||
|1 | NESTED-LOOP JOIN | |1 |4 |
|
||||
|2 | TABLE SCAN |A |1 |2 |
|
||||
|0 |SCALAR GROUP BY | |1 |6 |
|
||||
|1 | NESTED-LOOP JOIN | |1 |6 |
|
||||
|2 | TABLE SCAN |A(c1)|1 |5 |
|
||||
|3 | DISTRIBUTED TABLE SCAN|B(c2)|1 |16 |
|
||||
==================================================
|
||||
|
||||
@ -3533,10 +3533,11 @@ Outputs & filters:
|
||||
group(nil), agg_func([T_FUN_COUNT(*)])
|
||||
1 - output(nil), filter(nil), rowset=256,
|
||||
conds(nil), nl_params_([A.c1]), batch_join=true
|
||||
2 - output([A.c1]), filter([A.c1 >= 5630905], [A.c1 < 5631105], [A.c2 < 5631105], [A.c1 = A.c2]), rowset=256,
|
||||
access([A.c1], [A.c2]), partitions(p0),
|
||||
is_index_back=false, filter_before_indexback[false,false,false,false],
|
||||
range_key([A.__pk_increment]), range(MIN ; MAX)always true
|
||||
2 - output([A.c1]), filter([A.c2 < 5631105], [A.c1 = A.c2]), rowset=256,
|
||||
access([A.__pk_increment], [A.c1], [A.c2]), partitions(p0),
|
||||
is_index_back=true, filter_before_indexback[false,false],
|
||||
range_key([A.c1], [A.__pk_increment]), range(5630905,MIN ; 5631105,MIN),
|
||||
range_cond([A.c1 >= 5630905], [A.c1 < 5631105])
|
||||
3 - output(nil), filter(nil), rowset=256,
|
||||
access([GROUP_ID]), partitions(p0),
|
||||
is_index_back=false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user