patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -17,21 +17,21 @@ insert/*trace*/ into t1(id) values (107);
insert/*trace*/ into t2(id) values (107),(75),(1000);
EXPLAIN select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200;
Query Plan
=========================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
-----------------------------------------
|0 |NESTED-LOOP JOIN| |1 |73 |
|1 | TABLE SCAN |t1 |1 |36 |
|2 | TABLE GET |t2 |1 |36 |
=========================================
====================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
------------------------------------
|0 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |1 |2 |
====================================
Outputs & filters:
-------------------------------------
0 - output([t1.id], [t2.id]), filter(nil),
conds(nil), nl_params_([t1.id])
1 - output([t1.id]), filter(nil),
0 - output([t1.id], [t2.id]), filter(nil), rowset=256,
equal_conds([t2.id = t1.id]), other_conds(nil)
1 - output([t1.id]), filter(nil), rowset=256,
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil),
2 - output([t2.id]), filter(nil), rowset=256,
access([t2.id]), partitions(p0)
select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200;
@ -42,21 +42,21 @@ select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200;
EXPLAIN select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200 and t1.id<200;
Query Plan
=========================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
-----------------------------------------
|0 |NESTED-LOOP JOIN| |1 |73 |
|1 | TABLE SCAN |t1 |1 |36 |
|2 | TABLE GET |t2 |1 |36 |
=========================================
====================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
------------------------------------
|0 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |1 |2 |
====================================
Outputs & filters:
-------------------------------------
0 - output([t1.id], [t2.id]), filter(nil),
conds(nil), nl_params_([t1.id])
1 - output([t1.id]), filter(nil),
0 - output([t1.id], [t2.id]), filter(nil), rowset=256,
equal_conds([t2.id = t1.id]), other_conds(nil)
1 - output([t1.id]), filter(nil), rowset=256,
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil),
2 - output([t2.id]), filter(nil), rowset=256,
access([t2.id]), partitions(p0)
select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200 and t1.id<200;
@ -67,21 +67,21 @@ select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200 and t1.id<200;
EXPLAIN select a.id , b.id from t1 a, t2 b where a.id = b.id and a.id>200 and a.id<200;
Query Plan
=========================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
-----------------------------------------
|0 |NESTED-LOOP JOIN| |1 |73 |
|1 | TABLE SCAN |a |1 |36 |
|2 | TABLE GET |b |1 |36 |
=========================================
====================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
------------------------------------
|0 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|a |1 |2 |
|2 | TABLE SCAN|b |1 |2 |
====================================
Outputs & filters:
-------------------------------------
0 - output([a.id], [b.id]), filter(nil),
conds(nil), nl_params_([a.id])
1 - output([a.id]), filter(nil),
0 - output([a.id], [b.id]), filter(nil), rowset=256,
equal_conds([a.id = b.id]), other_conds(nil)
1 - output([a.id]), filter(nil), rowset=256,
access([a.id]), partitions(p0)
2 - output([b.id]), filter(nil),
2 - output([b.id]), filter(nil), rowset=256,
access([b.id]), partitions(p0)
select a.id , b.id from t1 a, t2 b where a.id = b.id and a.id>200 and a.id<200;
@ -95,20 +95,20 @@ Query Plan
===================================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
---------------------------------------------------
|0 |NESTED-LOOP JOIN CARTESIAN| |3 |75 |
|1 | TABLE SCAN |b |3 |37 |
|2 | MATERIAL | |1 |37 |
|3 | TABLE SCAN |a |1 |36 |
|0 |NESTED-LOOP JOIN CARTESIAN| |3 |4 |
|1 | TABLE SCAN |b |3 |2 |
|2 | MATERIAL | |1 |2 |
|3 | TABLE SCAN |a |1 |2 |
===================================================
Outputs & filters:
-------------------------------------
0 - output([a.id], [b.id]), filter(nil),
0 - output([a.id], [b.id]), filter(nil), rowset=256,
conds(nil), nl_params_(nil)
1 - output([b.id]), filter(nil),
1 - output([b.id]), filter(nil), rowset=256,
access([b.id]), partitions(p0)
2 - output([a.id]), filter(nil)
3 - output([a.id]), filter([a.id = a.id]),
2 - output([a.id]), filter(nil), rowset=256
3 - output([a.id]), filter([a.id = a.id]), rowset=256,
access([a.id]), partitions(p0)
select a.id, b.id from t1 a, t2 b where a.id = a.id and a.id>200 and a.id<200;

View File

@ -19,21 +19,21 @@ insert/*trace*/ into t2(id) values (107),(75),(1000);
EXPLAIN select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200;
Query Plan
=========================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
-----------------------------------------
|0 |NESTED-LOOP JOIN| |1 |73 |
|1 | TABLE SCAN |t1 |1 |36 |
|2 | TABLE GET |t2 |1 |36 |
=========================================
====================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
------------------------------------
|0 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |1 |2 |
====================================
Outputs & filters:
-------------------------------------
0 - output([t1.id], [t2.id]), filter(nil),
conds(nil), nl_params_([t1.id])
1 - output([t1.id]), filter(nil),
0 - output([t1.id], [t2.id]), filter(nil), rowset=256,
equal_conds([t2.id = t1.id]), other_conds(nil)
1 - output([t1.id]), filter(nil), rowset=256,
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil),
2 - output([t2.id]), filter(nil), rowset=256,
access([t2.id]), partitions(p0)
select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200;
@ -44,21 +44,21 @@ select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200;
EXPLAIN select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200 and t1.id<200;
Query Plan
=========================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
-----------------------------------------
|0 |NESTED-LOOP JOIN| |1 |73 |
|1 | TABLE SCAN |t1 |1 |36 |
|2 | TABLE GET |t2 |1 |36 |
=========================================
====================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
------------------------------------
|0 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |1 |2 |
====================================
Outputs & filters:
-------------------------------------
0 - output([t1.id], [t2.id]), filter(nil),
conds(nil), nl_params_([t1.id])
1 - output([t1.id]), filter(nil),
0 - output([t1.id], [t2.id]), filter(nil), rowset=256,
equal_conds([t2.id = t1.id]), other_conds(nil)
1 - output([t1.id]), filter(nil), rowset=256,
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil),
2 - output([t2.id]), filter(nil), rowset=256,
access([t2.id]), partitions(p0)
select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200 and t1.id<200;
@ -69,21 +69,21 @@ select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200 and t1.id<200
EXPLAIN select a.id , b.id from t1 a join t2 b on a.id = b.id and a.id>200 and a.id<200;
Query Plan
=========================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
-----------------------------------------
|0 |NESTED-LOOP JOIN| |1 |73 |
|1 | TABLE SCAN |a |1 |36 |
|2 | TABLE GET |b |1 |36 |
=========================================
====================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
------------------------------------
|0 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|a |1 |2 |
|2 | TABLE SCAN|b |1 |2 |
====================================
Outputs & filters:
-------------------------------------
0 - output([a.id], [b.id]), filter(nil),
conds(nil), nl_params_([a.id])
1 - output([a.id]), filter(nil),
0 - output([a.id], [b.id]), filter(nil), rowset=256,
equal_conds([a.id = b.id]), other_conds(nil)
1 - output([a.id]), filter(nil), rowset=256,
access([a.id]), partitions(p0)
2 - output([b.id]), filter(nil),
2 - output([b.id]), filter(nil), rowset=256,
access([b.id]), partitions(p0)
select a.id , b.id from t1 a join t2 b on a.id = b.id and a.id>200 and a.id<200;
@ -97,20 +97,20 @@ Query Plan
===================================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
---------------------------------------------------
|0 |NESTED-LOOP JOIN CARTESIAN| |3 |75 |
|1 | TABLE SCAN |b |3 |37 |
|2 | MATERIAL | |1 |37 |
|3 | TABLE SCAN |a |1 |36 |
|0 |NESTED-LOOP JOIN CARTESIAN| |3 |4 |
|1 | TABLE SCAN |b |3 |2 |
|2 | MATERIAL | |1 |2 |
|3 | TABLE SCAN |a |1 |2 |
===================================================
Outputs & filters:
-------------------------------------
0 - output([a.id], [b.id]), filter(nil),
0 - output([a.id], [b.id]), filter(nil), rowset=256,
conds(nil), nl_params_(nil)
1 - output([b.id]), filter(nil),
1 - output([b.id]), filter(nil), rowset=256,
access([b.id]), partitions(p0)
2 - output([a.id]), filter(nil)
3 - output([a.id]), filter([a.id = a.id]),
2 - output([a.id]), filter(nil), rowset=256
3 - output([a.id]), filter([a.id = a.id]), rowset=256,
access([a.id]), partitions(p0)
select a.id, b.id from t1 a join t2 b on a.id = a.id and a.id>200 and a.id<200;

View File

@ -19,21 +19,21 @@ insert/*trace*/ into t2(id) values (107),(75),(1000);
EXPLAIN select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200;
Query Plan
=========================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
-----------------------------------------
|0 |NESTED-LOOP JOIN| |1 |73 |
|1 | TABLE SCAN |t1 |1 |36 |
|2 | TABLE GET |t2 |1 |36 |
=========================================
====================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
------------------------------------
|0 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |1 |2 |
====================================
Outputs & filters:
-------------------------------------
0 - output([t1.id], [t2.id]), filter(nil),
conds(nil), nl_params_([t1.id])
1 - output([t1.id]), filter(nil),
0 - output([t1.id], [t2.id]), filter(nil), rowset=256,
equal_conds([t2.id = t1.id]), other_conds(nil)
1 - output([t1.id]), filter(nil), rowset=256,
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil),
2 - output([t2.id]), filter(nil), rowset=256,
access([t2.id]), partitions(p0)
select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200;
@ -44,21 +44,21 @@ select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200;
EXPLAIN select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200 and t1.id<200;
Query Plan
=========================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
-----------------------------------------
|0 |NESTED-LOOP JOIN| |1 |73 |
|1 | TABLE SCAN |t1 |1 |36 |
|2 | TABLE GET |t2 |1 |36 |
=========================================
====================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
------------------------------------
|0 |MERGE JOIN | |2 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |2 |2 |
====================================
Outputs & filters:
-------------------------------------
0 - output([t1.id], [t2.id]), filter(nil),
conds(nil), nl_params_([t1.id])
1 - output([t1.id]), filter(nil),
0 - output([t1.id], [t2.id]), filter(nil), rowset=256,
equal_conds([t2.id = t1.id]), other_conds(nil)
1 - output([t1.id]), filter(nil), rowset=256,
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil),
2 - output([t2.id]), filter(nil), rowset=256,
access([t2.id]), partitions(p0)
select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200 and t1.id<200;
@ -69,21 +69,21 @@ select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200 and t1.id<2
EXPLAIN select a.id , b.id from t1 a join t2 b on a.id = b.id where a.id>200 and a.id<200;
Query Plan
=========================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
-----------------------------------------
|0 |NESTED-LOOP JOIN| |1 |73 |
|1 | TABLE SCAN |a |1 |36 |
|2 | TABLE GET |b |1 |36 |
=========================================
====================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
------------------------------------
|0 |MERGE JOIN | |2 |4 |
|1 | TABLE SCAN|a |1 |2 |
|2 | TABLE SCAN|b |2 |2 |
====================================
Outputs & filters:
-------------------------------------
0 - output([a.id], [b.id]), filter(nil),
conds(nil), nl_params_([a.id])
1 - output([a.id]), filter(nil),
0 - output([a.id], [b.id]), filter(nil), rowset=256,
equal_conds([a.id = b.id]), other_conds(nil)
1 - output([a.id]), filter(nil), rowset=256,
access([a.id]), partitions(p0)
2 - output([b.id]), filter(nil),
2 - output([b.id]), filter(nil), rowset=256,
access([b.id]), partitions(p0)
select a.id , b.id from t1 a join t2 b on a.id = b.id where a.id>200 and a.id<200;
@ -97,20 +97,20 @@ Query Plan
===================================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
---------------------------------------------------
|0 |NESTED-LOOP JOIN CARTESIAN| |3 |75 |
|1 | TABLE SCAN |b |3 |37 |
|2 | MATERIAL | |1 |37 |
|3 | TABLE SCAN |a |1 |36 |
|0 |NESTED-LOOP JOIN CARTESIAN| |3 |4 |
|1 | TABLE SCAN |b |3 |2 |
|2 | MATERIAL | |1 |2 |
|3 | TABLE SCAN |a |1 |2 |
===================================================
Outputs & filters:
-------------------------------------
0 - output([a.id], [b.id]), filter(nil),
0 - output([a.id], [b.id]), filter(nil), rowset=256,
conds(nil), nl_params_(nil)
1 - output([b.id]), filter(nil),
1 - output([b.id]), filter(nil), rowset=256,
access([b.id]), partitions(p0)
2 - output([a.id]), filter(nil)
3 - output([a.id]), filter([a.id = a.id]),
2 - output([a.id]), filter(nil), rowset=256
3 - output([a.id]), filter([a.id = a.id]), rowset=256,
access([a.id]), partitions(p0)
select a.id , b.id from t1 a join t2 b on a.id = a.id where a.id>200 and a.id<200;

View File

@ -77,6 +77,7 @@ select /*+ USE_HASH(xy_t1, xy_t2)*/ c1, c2, c1, c2 from xy_t1 where exists (sele
drop table xy_t1, xy_t2;
## bug:https://aone.alibaba-inc.com/issue/15280254?spm=a2o8d.corp_prod_issue_list.0.0.3f6630500agegh&stat=1.5.0&toPage=1&versionId=1043693
--disable_warnings
drop table if exists xy_x_t, xy_y_t;
--enable_warnings
@ -105,6 +106,7 @@ select /*+use_nl(xy_x_t xy_y_t)*/ * from xy_x_t where x1 not in (select y1 from
drop table xy_x_t, xy_y_t;
### bug 15280254 end
### ********************* test right semi/anti join
--disable_warnings

View File

@ -20,6 +20,13 @@ delete from aa;
insert into aa(a2, a3) values (10, 15), (10, 14), (10, 12), (11, 13), (12, 12), (12, 10);
delete from bb;
insert into bb(b2, b3) values (10, 14), (11, 14), (11, 13), (12, 11), (12, 10);
--source mysql_test/include/minorfreeze.inc
--real_sleep 10
--source mysql_test/include/wait_minor_merge.inc
--disable_query_log
call dbms_stats.gather_table_stats('test','aa', method_opt=>'FOR ALL COLUMNS SIZE AUTO');
call dbms_stats.gather_table_stats('test','bb', method_opt=>'FOR ALL COLUMNS SIZE AUTO');
--enable_query_log
--sleep 1
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3;
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3;
@ -177,6 +184,7 @@ select /*+use_merge(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 inner join t_r4_01_20
drop table if exists t_r4_01_20;
--enable_warnings
## bug:https://aone.alibaba-inc.com/issue/9211556?spm=a2o8d.corp_prod_issue_list.0.0.25893050Y8aynZ&stat=1.5.38&toPage=1&versionId=1043693
--disable_warnings
drop table if exists t2, t7;
--enable_warnings
@ -246,6 +254,7 @@ explain select /*+use_nl(t2,t7)*/* from t2 left join t7 on t2.b = t7.a and t2.c
select /*+use_nl(t2,t7)*/* from t2 left join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
## bug: 9211556 end
--echo ********** join condition 必须和 ordering 排序一致
explain select /*+use_merge(t8 t9)*/ * from t8 join t9 on t8.c = t9.c and t8.b = t9.b;
@ -272,6 +281,7 @@ select /*+use_merge(t8 t9)*/ * from t8 right join t9 on t8.c = t9.c and t8.b = t
explain select /*+index(t8 idx), index(t9 idx), use_merge(t8 t9)*/ * from t8 full join t9 on t8.a = t9.b and t8.b = t9.a;
select /*+index(t8 idx), index(t9 idx), use_merge(t8 t9)*/ * from t8 full join t9 on t8.a = t9.b and t8.b = t9.a;
## misc bug 21243815
--disable_warnings
drop table if exists BB,CC;
--enable_warnings
@ -290,6 +300,49 @@ explain SELECT /*+no_rewrite,leading(table1 table2),use_merge(table1 table2)*/
SELECT /*+no_rewrite,leading(table1 table2),use_merge(table1 table2)*/ table1 . col_varchar_10_key AS field1 FROM BB AS table1, CC AS table2 WHERE table1 . `col_int_key` = table2 . `pk` and table2 . `col_int_key` = table1 . `pk` ORDER BY table1 . col_int_key DESC;
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
create table t1 (c1 int);
create table t2 (c1 int);
insert into t1 values(1);
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
select count(*) from (select /*+leading(t1 t2) use_merge(t2)*/* from t1 where t1.c1 in (select * from t2));
select count(*) from (select /*+leading(t1 t2) use_hash(t2)*/* from t1 where t1.c1 in (select * from t2));
select count(*) from (select /*+leading(t1 t2) use_merge(t2)*/* from t1 where not exists (select 1 from t2 where t1.c1 = t2.c1));
select count(*) from (select /*+leading(t1 t2) use_hash(t2)*/* from t1 where not exists (select 1 from t2 where t1.c1 = t2.c1));
alter system set _rowsets_enabled = true;
set ob_enable_plan_cache=0;
select count(*) from (select /*+leading(t1 t2) use_merge(t2)*/* from t1 where t1.c1 in (select * from t2));
select count(*) from (select /*+leading(t1 t2) use_hash(t2)*/* from t1 where t1.c1 in (select * from t2));
select count(*) from (select /*+leading(t1 t2) use_merge(t2)*/* from t1 where not exists (select 1 from t2 where t1.c1 = t2.c1));
select count(*) from (select /*+leading(t1 t2) use_hash(t2)*/* from t1 where not exists (select 1 from t2 where t1.c1 = t2.c1));
set ob_enable_plan_cache=1;
drop table t1;
drop table t2;
--disable_warnings
drop table if exists t2, t7, t8, t9, BB, CC;
--enable_warnings