[FEAT MERGE]4_1_sql_feature

Co-authored-by: leslieyuchen <leslieyuchen@gmail.com>
Co-authored-by: Charles0429 <xiezhenjiang@gmail.com>
Co-authored-by: raywill <hustos@gmail.com>
This commit is contained in:
obdev
2023-01-28 16:01:26 +08:00
committed by ob-robot
parent 3080f2b66f
commit 2d19a9d8f5
846 changed files with 161957 additions and 116661 deletions

View File

@ -17,23 +17,28 @@ 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 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |1 |2 |
====================================
Outputs & filters:
===========================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-------------------------------------------
|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), rowset=256,
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,
merge_directions([ASC])
1 - output([t1.id]), filter(nil), rowset=256
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([t1.id]), range(200 ; MAX),
range_cond([t1.id > 200])
2 - output([t2.id]), filter(nil), rowset=256
access([t2.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t2.id]), range(200 ; MAX),
range_cond([t2.id > 200])
select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200;
+----+----+
| id | id |
@ -42,23 +47,28 @@ 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 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |1 |2 |
====================================
Outputs & filters:
===========================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-------------------------------------------
|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), rowset=256,
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,
merge_directions([ASC])
1 - output([t1.id]), filter(nil), rowset=256
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([t1.id]), range(MAX ; MIN)always false,
range_cond([t1.id > 200], [t1.id < 200])
2 - output([t2.id]), filter(nil), rowset=256
access([t2.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t2.id]), range(200 ; MAX),
range_cond([t2.id > 200])
select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200 and t1.id<200;
+----+----+
| id | id |
@ -67,23 +77,28 @@ 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 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|a |1 |2 |
|2 | TABLE SCAN|b |1 |2 |
====================================
Outputs & filters:
===========================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-------------------------------------------
|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), rowset=256,
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,
merge_directions([ASC])
1 - output([a.id]), filter(nil), rowset=256
access([a.id]), partitions(p0)
2 - output([b.id]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([a.id]), range(MAX ; MIN)always false,
range_cond([a.id > 200], [a.id < 200])
2 - output([b.id]), filter(nil), rowset=256
access([b.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([b.id]), range(200 ; MAX),
range_cond([b.id > 200])
select a.id , b.id from t1 a, t2 b where a.id = b.id and a.id>200 and a.id<200;
+----+----+
| id | id |
@ -92,25 +107,28 @@ select a.id , b.id from t1 a, t2 b where a.id = b.id and a.id>200 and a.id<200;
EXPLAIN select a.id, b.id from t1 a, t2 b where a.id = a.id and a.id>200 and a.id<200;
Query Plan
===================================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
---------------------------------------------------
|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:
===========================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------
|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), rowset=256,
conds(nil), nl_params_(nil)
1 - output([b.id]), filter(nil), rowset=256,
0 - output([a.id], [b.id]), filter(nil), rowset=256
conds(nil), nl_params_(nil), batch_join=false
1 - output([b.id]), filter(nil), rowset=256
access([b.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([b.id]), range(MIN ; MAX)always true
2 - output([a.id]), filter(nil), rowset=256
3 - output([a.id]), filter([a.id = a.id]), rowset=256,
3 - output([a.id]), filter([a.id = a.id]), rowset=256
access([a.id]), partitions(p0)
is_index_back=false, is_global_index=false, filter_before_indexback[false],
range_key([a.id]), range(MAX ; MIN)always false,
range_cond([a.id > 200], [a.id < 200])
select a.id, b.id from t1 a, t2 b where a.id = a.id and a.id>200 and a.id<200;
+----+----+
| id | id |

View File

@ -19,23 +19,28 @@ 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 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |1 |2 |
====================================
Outputs & filters:
===========================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-------------------------------------------
|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), rowset=256,
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,
merge_directions([ASC])
1 - output([t1.id]), filter(nil), rowset=256
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([t1.id]), range(200 ; MAX),
range_cond([t1.id > 200])
2 - output([t2.id]), filter(nil), rowset=256
access([t2.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t2.id]), range(200 ; MAX),
range_cond([t2.id > 200])
select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200;
+----+----+
| id | id |
@ -44,23 +49,28 @@ 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 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |1 |2 |
====================================
Outputs & filters:
===========================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-------------------------------------------
|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), rowset=256,
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,
merge_directions([ASC])
1 - output([t1.id]), filter(nil), rowset=256
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([t1.id]), range(MAX ; MIN)always false,
range_cond([t1.id > 200], [t1.id < 200])
2 - output([t2.id]), filter(nil), rowset=256
access([t2.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t2.id]), range(200 ; MAX),
range_cond([t2.id > 200])
select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200 and t1.id<200;
+----+----+
| id | id |
@ -69,23 +79,28 @@ 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 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|a |1 |2 |
|2 | TABLE SCAN|b |1 |2 |
====================================
Outputs & filters:
===========================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-------------------------------------------
|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), rowset=256,
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,
merge_directions([ASC])
1 - output([a.id]), filter(nil), rowset=256
access([a.id]), partitions(p0)
2 - output([b.id]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([a.id]), range(MAX ; MIN)always false,
range_cond([a.id > 200], [a.id < 200])
2 - output([b.id]), filter(nil), rowset=256
access([b.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([b.id]), range(200 ; MAX),
range_cond([b.id > 200])
select a.id , b.id from t1 a join t2 b on a.id = b.id and a.id>200 and a.id<200;
+----+----+
| id | id |
@ -94,25 +109,28 @@ select a.id , b.id from t1 a join t2 b on a.id = b.id and a.id>200 and a.id<200;
EXPLAIN select a.id, b.id from t1 a join t2 b on a.id = a.id and a.id>200 and a.id<200;
Query Plan
===================================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
---------------------------------------------------
|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:
===========================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------
|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), rowset=256,
conds(nil), nl_params_(nil)
1 - output([b.id]), filter(nil), rowset=256,
0 - output([a.id], [b.id]), filter(nil), rowset=256
conds(nil), nl_params_(nil), batch_join=false
1 - output([b.id]), filter(nil), rowset=256
access([b.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([b.id]), range(MIN ; MAX)always true
2 - output([a.id]), filter(nil), rowset=256
3 - output([a.id]), filter([a.id = a.id]), rowset=256,
3 - output([a.id]), filter([a.id = a.id]), rowset=256
access([a.id]), partitions(p0)
is_index_back=false, is_global_index=false, filter_before_indexback[false],
range_key([a.id]), range(MAX ; MIN)always false,
range_cond([a.id > 200], [a.id < 200])
select a.id, b.id from t1 a join t2 b on a.id = a.id and a.id>200 and a.id<200;
+----+----+
| id | id |

View File

@ -19,23 +19,28 @@ 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 |MERGE JOIN | |1 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |1 |2 |
====================================
Outputs & filters:
===========================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-------------------------------------------
|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), rowset=256,
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,
merge_directions([ASC])
1 - output([t1.id]), filter(nil), rowset=256
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([t1.id]), range(200 ; MAX),
range_cond([t1.id > 200])
2 - output([t2.id]), filter(nil), rowset=256
access([t2.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t2.id]), range(200 ; MAX),
range_cond([t2.id > 200])
select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200;
+----+----+
| id | id |
@ -44,23 +49,28 @@ 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 |MERGE JOIN | |2 |4 |
|1 | TABLE SCAN|t1 |1 |2 |
|2 | TABLE SCAN|t2 |2 |2 |
====================================
Outputs & filters:
===========================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-------------------------------------------
|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), rowset=256,
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,
merge_directions([ASC])
1 - output([t1.id]), filter(nil), rowset=256
access([t1.id]), partitions(p0)
2 - output([t2.id]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([t1.id]), range(200 ; MAX),
range_cond([t1.id > 200])
2 - output([t2.id]), filter(nil), rowset=256
access([t2.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t2.id]), range(NULL ; 200),
range_cond([t2.id < 200])
select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200 and t1.id<200;
+----+----+
| id | id |
@ -69,23 +79,28 @@ 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 |MERGE JOIN | |2 |4 |
|1 | TABLE SCAN|a |1 |2 |
|2 | TABLE SCAN|b |2 |2 |
====================================
Outputs & filters:
===========================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-------------------------------------------
|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), rowset=256,
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,
merge_directions([ASC])
1 - output([a.id]), filter(nil), rowset=256
access([a.id]), partitions(p0)
2 - output([b.id]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([a.id]), range(200 ; MAX),
range_cond([a.id > 200])
2 - output([b.id]), filter(nil), rowset=256
access([b.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([b.id]), range(NULL ; 200),
range_cond([b.id < 200])
select a.id , b.id from t1 a join t2 b on a.id = b.id where a.id>200 and a.id<200;
+----+----+
| id | id |
@ -94,25 +109,28 @@ select a.id , b.id from t1 a join t2 b on a.id = b.id where a.id>200 and a.id<20
EXPLAIN select a.id , b.id from t1 a join t2 b on a.id = a.id where a.id>200 and a.id<200;
Query Plan
===================================================
|ID|OPERATOR |NAME|EST. ROWS|COST|
---------------------------------------------------
|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:
===========================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------
|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), rowset=256,
conds(nil), nl_params_(nil)
1 - output([b.id]), filter(nil), rowset=256,
0 - output([a.id], [b.id]), filter(nil), rowset=256
conds(nil), nl_params_(nil), batch_join=false
1 - output([b.id]), filter(nil), rowset=256
access([b.id]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([b.id]), range(MIN ; MAX)always true
2 - output([a.id]), filter(nil), rowset=256
3 - output([a.id]), filter([a.id = a.id]), rowset=256,
3 - output([a.id]), filter([a.id = a.id]), rowset=256
access([a.id]), partitions(p0)
is_index_back=false, is_global_index=false, filter_before_indexback[false],
range_key([a.id]), range(MAX ; MIN)always false,
range_cond([a.id > 200], [a.id < 200])
select a.id , b.id from t1 a join t2 b on a.id = a.id where a.id>200 and a.id<200;
+----+----+
| id | id |