[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:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -26,22 +26,20 @@ select * from t1;
|
||||
|
||||
explain insert into t2 (c1, c2) values ('0', '1');
|
||||
Query Plan
|
||||
===========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-------------------------------------------
|
||||
|0 |DISTRIBUTED INSERT| |1 |13 |
|
||||
|1 | EXPRESSION | |1 |1 |
|
||||
===========================================
|
||||
|
||||
Outputs & filters:
|
||||
==================================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
--------------------------------------------------
|
||||
|0 |DISTRIBUTED INSERT| |1 |13 |
|
||||
|1 | EXPRESSION | |1 |1 |
|
||||
==================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output(nil), filter(nil),
|
||||
0 - output(nil), filter(nil)
|
||||
columns([{t2: ({t2: (t2.c1, t2.c2)})}]),
|
||||
column_values([column_conv(INT,PS:(11,0),NOT NULL,t2.c1.nextval(column_conv(INT,PS:(11,0),NOT NULL,__values.c1)))], [column_conv(INT,PS:(11,0),NULL,__values.c2)])
|
||||
1 - output([__values.c1], [__values.c2]), filter(nil)
|
||||
values({'0', '1'})
|
||||
|
||||
|
||||
insert into t2 (c1, c2) values (NULL, '1');
|
||||
insert into t2 (c1, c2) values (0, '2');
|
||||
insert into t2 (c2) values ('3');
|
||||
|
||||
@ -7319,17 +7319,17 @@ insert into t1 values('1901-01-01', 1901);
|
||||
explain_protocol: 2
|
||||
EXPLAIN select nullif(c1, c2) from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([nullif(t1.c1, t1.c2)]), filter(nil), rowset=256,
|
||||
0 - output([nullif(t1.c1, t1.c2)]), filter(nil), rowset=256
|
||||
access([t1.c1], [t1.c2]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select nullif(c1, c2) from t1;
|
||||
+---------------------------+
|
||||
| nullif(c1, c2) |
|
||||
@ -7338,17 +7338,17 @@ select nullif(c1, c2) from t1;
|
||||
+---------------------------+
|
||||
EXPLAIN select nullif(c2, c1) from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([nullif(t1.c2, t1.c1)]), filter(nil), rowset=256,
|
||||
0 - output([nullif(t1.c2, t1.c1)]), filter(nil), rowset=256
|
||||
access([t1.c2], [t1.c1]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select nullif(c2, c1) from t1;
|
||||
+----------------+
|
||||
| nullif(c2, c1) |
|
||||
@ -7357,17 +7357,17 @@ select nullif(c2, c1) from t1;
|
||||
+----------------+
|
||||
EXPLAIN select nullif(c1, c1) from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([nullif(t1.c1, t1.c1)]), filter(nil), rowset=256,
|
||||
0 - output([nullif(t1.c1, t1.c1)]), filter(nil), rowset=256
|
||||
access([t1.c1]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select nullif(c1, c1) from t1;
|
||||
+----------------+
|
||||
| nullif(c1, c1) |
|
||||
@ -7376,17 +7376,17 @@ select nullif(c1, c1) from t1;
|
||||
+----------------+
|
||||
EXPLAIN select nullif(c2, c2) from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([nullif(t1.c2, t1.c2)]), filter(nil), rowset=256,
|
||||
0 - output([nullif(t1.c2, t1.c2)]), filter(nil), rowset=256
|
||||
access([t1.c2]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select nullif(c2, c2) from t1;
|
||||
+----------------+
|
||||
| nullif(c2, c2) |
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ select regexp_like('abc', 'a.* ', NULL) from dual;
|
||||
| NULL |
|
||||
+----------------------------------+
|
||||
select regexp_like('abc', 'a.* ', 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_like('abc', NULL) from dual;
|
||||
+--------------------------+
|
||||
| regexp_like('abc', NULL) |
|
||||
@ -74,17 +74,17 @@ select regexp_instr('abcadef', 'a.', 1, 2, 1) from dual;
|
||||
| 6 |
|
||||
+----------------------------------------+
|
||||
select regexp_instr('abcadef', 'a.', 0, 2, 1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use position or occurrence or return_option or subexpr in regexp_instr
|
||||
select regexp_instr('abcadef', 'a.', 1, 0, 1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
+----------------------------------------+
|
||||
| regexp_instr('abcadef', 'a.', 1, 0, 1) |
|
||||
+----------------------------------------+
|
||||
| 3 |
|
||||
+----------------------------------------+
|
||||
select regexp_instr('abcadef', 'a.', 1, 2, -1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use position or occurrence or return_option or subexpr in regexp_instr
|
||||
select regexp_instr('abcadef', 'a.', 100, 2) from dual;
|
||||
+---------------------------------------+
|
||||
| regexp_instr('abcadef', 'a.', 100, 2) |
|
||||
+---------------------------------------+
|
||||
| 0 |
|
||||
+---------------------------------------+
|
||||
ERROR 42000: Got error 'U_INDEX_OUTOFBOUNDS_ERROR' from regexp
|
||||
select regexp_instr('abcadef', 'a.', 1, 200) from dual;
|
||||
+---------------------------------------+
|
||||
| regexp_instr('abcadef', 'a.', 1, 200) |
|
||||
@ -92,17 +92,17 @@ select regexp_instr('abcadef', 'a.', 1, 200) from dual;
|
||||
| 0 |
|
||||
+---------------------------------------+
|
||||
select regexp_instr('abcadef', 'a. ', 1, 2, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_instr('', 'a. ', 1, 2, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_instr('abcadef', '', 1, 2, 1, 'x') from dual;
|
||||
ERROR 42000: Got error from regexp
|
||||
select regexp_instr('abcadef', 'a. ', NULL, 2, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_instr('abcadef', 'a. ', 1, NULL, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_instr('abcadef', 'a. ', 1, 2, NULL, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_instr('abcadef', 'a. ', 1, 2, 1, NULL) from dual;
|
||||
+-----------------------------------------------+
|
||||
| regexp_instr('abcadef', 'a. ', 1, 2, 1, NULL) |
|
||||
@ -136,15 +136,11 @@ select regexp_substr('abcadef', 'a.', 1, 2) from dual;
|
||||
| ad |
|
||||
+--------------------------------------+
|
||||
select regexp_substr('abcadef', 'a.', 0, 2) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use position or occurrence or subexpr in regexp_substr
|
||||
select regexp_substr('abcadef', 'a.', 1, 0) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use position or occurrence or subexpr in regexp_substr
|
||||
select regexp_substr('abcadef', 'a.', 10, 2) from dual;
|
||||
+---------------------------------------+
|
||||
| regexp_substr('abcadef', 'a.', 10, 2) |
|
||||
+---------------------------------------+
|
||||
| NULL |
|
||||
+---------------------------------------+
|
||||
ERROR 42000: Got error 'U_INDEX_OUTOFBOUNDS_ERROR' from regexp
|
||||
select regexp_substr('abcadef', 'a.', 1, 10) from dual;
|
||||
+---------------------------------------+
|
||||
| regexp_substr('abcadef', 'a.', 1, 10) |
|
||||
@ -152,15 +148,15 @@ select regexp_substr('abcadef', 'a.', 1, 10) from dual;
|
||||
| NULL |
|
||||
+---------------------------------------+
|
||||
select regexp_substr('abcadef', 'a. ', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_substr('', 'a. ', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_substr('abcadef', '', 1, 2, 'x') from dual;
|
||||
ERROR 42000: Got error from regexp
|
||||
select regexp_substr('abcadef', 'a. ', NULL, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_substr('abcadef', 'a. ', 1, NULL, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_substr('abcadef', 'a. ', 1, 2, NULL) from dual;
|
||||
+---------------------------------------------+
|
||||
| regexp_substr('abcadef', 'a. ', 1, 2, NULL) |
|
||||
@ -232,13 +228,9 @@ select regexp_replace('abcadef', 'a.', 'X', 1, 0) from dual;
|
||||
| XcXef |
|
||||
+--------------------------------------------+
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1, -1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use position or occurrence in regexp_replace
|
||||
select regexp_replace('abcadef', 'a.', 'X', 10, 2) from dual;
|
||||
+---------------------------------------------+
|
||||
| regexp_replace('abcadef', 'a.', 'X', 10, 2) |
|
||||
+---------------------------------------------+
|
||||
| abcadef |
|
||||
+---------------------------------------------+
|
||||
ERROR 42000: Got error 'U_INDEX_OUTOFBOUNDS_ERROR' from regexp
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1, 100) from dual;
|
||||
+----------------------------------------------+
|
||||
| regexp_replace('abcadef', 'a.', 'X', 1, 100) |
|
||||
@ -252,17 +244,17 @@ select regexp_replace('abcadef', 'a. ', 'X', 1, 2) from dual;
|
||||
| abcadef |
|
||||
+---------------------------------------------+
|
||||
select regexp_replace('abcadef', 'a. ', 'X', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_replace('', 'a. ', 'X', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_replace('abcadef', '', 'X', 1, 2, 'x') from dual;
|
||||
ERROR 42000: Got error from regexp
|
||||
select regexp_replace('abcadef', 'a. ', NULL, 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_replace('abcadef', 'a. ', 'X', NULL, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_replace('abcadef', 'a. ', 'X', 1, NULL, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
ERROR HY000: Incorrect arguments to use match param in regexp expression
|
||||
select regexp_replace('abcadef', 'a. ', 'X', 1, 2, NULL) from dual;
|
||||
+---------------------------------------------------+
|
||||
| regexp_replace('abcadef', 'a. ', 'X', 1, 2, NULL) |
|
||||
|
||||
@ -390,22 +390,22 @@ select * from t2 order by sign(a4) ;
|
||||
| a1 | a2 | a3 | a4 | a5 |
|
||||
+-----+------+------+--------+---------------------+
|
||||
| XXX | NULL | MIN | NULL | timestamp |
|
||||
| WWW | 1 | LED | NULL | timestamp |
|
||||
| SSJ | NULL | CHI | NULL | timestamp |
|
||||
| KKK | -3 | ATL | NULL | timestamp |
|
||||
| BDL | 0 | DEN | -0.08 | timestamp |
|
||||
| ZAJ | 2 | CHI | -0.075 | timestamp |
|
||||
| TWU | 0 | LAX | -0.08 | timestamp |
|
||||
| PLS | -1 | WDC | -0.075 | timestamp |
|
||||
| GTM | 3 | DAL | -0.07 | timestamp |
|
||||
| SSJ | NULL | CHI | NULL | timestamp |
|
||||
| WWW | 1 | LED | NULL | timestamp |
|
||||
| GG3 | -3 | DD3 | -0.051 | timestamp |
|
||||
| BOT | -2 | SEA | -0.085 | timestamp |
|
||||
| GTM | 3 | DAL | -0.07 | timestamp |
|
||||
| ZAJ | 2 | CHI | -0.075 | timestamp |
|
||||
| BDL | 0 | DEN | -0.08 | timestamp |
|
||||
| PLS | -1 | WDC | -0.075 | timestamp |
|
||||
| BMC | 3 | SEA | -0.085 | timestamp |
|
||||
| TWU | 0 | LAX | -0.08 | timestamp |
|
||||
| BOT | -2 | SEA | -0.085 | timestamp |
|
||||
| HBR | 1 | SEA | 0.085 | timestamp |
|
||||
| GG2 | -3 | DD2 | 0.052 | timestamp |
|
||||
| GG1 | 3 | DD1 | 0.053 | timestamp |
|
||||
| DTX | 1 | NYC | 0.08 | timestamp |
|
||||
| VVV | -2 | MON | 0.075 | timestamp |
|
||||
| GG1 | 3 | DD1 | 0.053 | timestamp |
|
||||
| GG2 | -3 | DD2 | 0.052 | timestamp |
|
||||
| AME | 0 | SEA | 0.1 | timestamp |
|
||||
+-----+------+------+--------+---------------------+
|
||||
select * from t2 order by sign(a4) , a4 ;
|
||||
@ -413,9 +413,9 @@ select * from t2 order by sign(a4) , a4 ;
|
||||
| a1 | a2 | a3 | a4 | a5 |
|
||||
+-----+------+------+--------+---------------------+
|
||||
| XXX | NULL | MIN | NULL | timestamp |
|
||||
| WWW | 1 | LED | NULL | timestamp |
|
||||
| SSJ | NULL | CHI | NULL | timestamp |
|
||||
| KKK | -3 | ATL | NULL | timestamp |
|
||||
| SSJ | NULL | CHI | NULL | timestamp |
|
||||
| WWW | 1 | LED | NULL | timestamp |
|
||||
| BMC | 3 | SEA | -0.085 | timestamp |
|
||||
| BOT | -2 | SEA | -0.085 | timestamp |
|
||||
| BDL | 0 | DEN | -0.08 | timestamp |
|
||||
@ -720,22 +720,22 @@ select * from t2 order by sign(a4) for update;
|
||||
| a1 | a2 | a3 | a4 | a5 |
|
||||
+-----+------+------+--------+---------------------+
|
||||
| XXX | NULL | MIN | NULL | NULL |
|
||||
| WWW | 1 | LED | NULL | NULL |
|
||||
| SSJ | NULL | CHI | NULL | 1974-03-19 00:00:00 |
|
||||
| KKK | -3 | ATL | NULL | NULL |
|
||||
| BDL | 0 | DEN | -0.08 | 1960-11-27 00:00:00 |
|
||||
| ZAJ | 2 | CHI | -0.075 | 1960-06-15 00:00:00 |
|
||||
| TWU | 0 | LAX | -0.08 | 1969-10-05 00:00:00 |
|
||||
| PLS | -1 | WDC | -0.075 | 1949-01-02 00:00:00 |
|
||||
| GTM | 3 | DAL | -0.07 | 1977-09-23 00:00:00 |
|
||||
| SSJ | NULL | CHI | NULL | 1974-03-19 00:00:00 |
|
||||
| WWW | 1 | LED | NULL | NULL |
|
||||
| GG3 | -3 | DD3 | -0.051 | 1974-03-19 00:00:00 |
|
||||
| BOT | -2 | SEA | -0.085 | 1951-11-29 00:00:00 |
|
||||
| GTM | 3 | DAL | -0.07 | 1977-09-23 00:00:00 |
|
||||
| ZAJ | 2 | CHI | -0.075 | 1960-06-15 00:00:00 |
|
||||
| BDL | 0 | DEN | -0.08 | 1960-11-27 00:00:00 |
|
||||
| PLS | -1 | WDC | -0.075 | 1949-01-02 00:00:00 |
|
||||
| BMC | 3 | SEA | -0.085 | 1958-09-08 00:00:00 |
|
||||
| TWU | 0 | LAX | -0.08 | 1969-10-05 00:00:00 |
|
||||
| BOT | -2 | SEA | -0.085 | 1951-11-29 00:00:00 |
|
||||
| HBR | 1 | SEA | 0.085 | 1948-03-05 00:00:00 |
|
||||
| GG2 | -3 | DD2 | 0.052 | 1974-03-19 00:00:00 |
|
||||
| GG1 | 3 | DD1 | 0.053 | 1974-03-19 00:00:00 |
|
||||
| DTX | 1 | NYC | 0.08 | 1961-05-04 00:00:00 |
|
||||
| VVV | -2 | MON | 0.075 | 1959-06-28 00:00:00 |
|
||||
| GG1 | 3 | DD1 | 0.053 | 1974-03-19 00:00:00 |
|
||||
| GG2 | -3 | DD2 | 0.052 | 1974-03-19 00:00:00 |
|
||||
| AME | 0 | SEA | 0.1 | 1942-02-19 00:00:00 |
|
||||
+-----+------+------+--------+---------------------+
|
||||
select abs(a2) , sum(a4) from t2 group by abs(a2) having sum(sign(a4)) > 0 for update;
|
||||
|
||||
@ -110,17 +110,15 @@ select substr(3.14159, 2, 3) from dual;
|
||||
+-----------------------+
|
||||
explain select substr(3.14159, '2', '3') from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([substr(cast(3.14159, VARCHAR(1048576)), cast('2', BIGINT(-1, 0)), cast('3', BIGINT(-1, 0)))]), filter(nil)
|
||||
values({substr(cast(3.14159, VARCHAR(1048576)), cast('2', BIGINT(-1, 0)), cast('3', BIGINT(-1, 0)))})
|
||||
|
||||
select substr(3.14159, '2', '2.1') from dual;
|
||||
+-----------------------------+
|
||||
| substr(3.14159, '2', '2.1') |
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -26,46 +26,50 @@ explain_protocol: 2
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
explain select * from t1,t2;
|
||||
Query Plan
|
||||
===================================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
---------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN CARTESIAN| |25 |6 |
|
||||
|1 | TABLE SCAN |t1 |5 |3 |
|
||||
|2 | MATERIAL | |5 |3 |
|
||||
|3 | TABLE SCAN |t2 |5 |3 |
|
||||
===================================================
|
||||
|
||||
Outputs & filters:
|
||||
===========================================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
-----------------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN CARTESIAN | |25 |6 |
|
||||
|1 | TABLE SCAN |t1 |5 |3 |
|
||||
|2 | MATERIAL | |5 |3 |
|
||||
|3 | TABLE SCAN |t2 |5 |3 |
|
||||
===========================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=256,
|
||||
conds(nil), nl_params_(nil)
|
||||
1 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=256
|
||||
conds(nil), nl_params_(nil), batch_join=false
|
||||
1 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
2 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=256
|
||||
3 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=256,
|
||||
3 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=256
|
||||
access([t2.c1], [t2.c2], [t2.c3]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t2.__pk_increment]), range(MIN ; MAX)always true
|
||||
EXPLAIN select * from t1,t2;
|
||||
Query Plan
|
||||
===================================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
---------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN CARTESIAN| |25 |6 |
|
||||
|1 | TABLE SCAN |t1 |5 |3 |
|
||||
|2 | MATERIAL | |5 |3 |
|
||||
|3 | TABLE SCAN |t2 |5 |3 |
|
||||
===================================================
|
||||
|
||||
Outputs & filters:
|
||||
===========================================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
-----------------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN CARTESIAN | |25 |6 |
|
||||
|1 | TABLE SCAN |t1 |5 |3 |
|
||||
|2 | MATERIAL | |5 |3 |
|
||||
|3 | TABLE SCAN |t2 |5 |3 |
|
||||
===========================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=256,
|
||||
conds(nil), nl_params_(nil)
|
||||
1 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=256
|
||||
conds(nil), nl_params_(nil), batch_join=false
|
||||
1 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
2 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=256
|
||||
3 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=256,
|
||||
3 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=256
|
||||
access([t2.c1], [t2.c2], [t2.c3]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t2.__pk_increment]), range(MIN ; MAX)always true
|
||||
select * from t1,t2;
|
||||
+------+------+------+------+------+------+
|
||||
| c1 | c2 | c3 | c1 | c2 | c3 |
|
||||
|
||||
@ -57,15 +57,17 @@ Query Plan
|
||||
|2 | PX PARTITION ITERATOR| |
|
||||
|3 | TABLE SCAN |a |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256
|
||||
1 - output([INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256, dop=1
|
||||
1 - output([INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256
|
||||
dop=1
|
||||
2 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
3 - output([a.c1], [a.c2]), filter(nil), rowset=256,
|
||||
force partition granule
|
||||
3 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
access([a.c1], [a.c2]), partitions(p[0-4])
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.c1]), range(MIN ; MAX)always true
|
||||
select * from t3 a ;
|
||||
+----+------+
|
||||
| c1 | c2 |
|
||||
@ -91,16 +93,19 @@ Query Plan
|
||||
|3 | PX BLOCK ITERATOR | |
|
||||
|4 | TABLE SCAN |a |
|
||||
========================================
|
||||
|
||||
Outputs & filters:
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2 + a.c1)]), filter(nil), rowset=256, sort_keys([a.c2 + 1 + a.c1, ASC])
|
||||
1 - output([a.c2 + 1 + a.c1], [INTERNAL_FUNCTION(a.c1, a.c2 + a.c1)]), filter(nil), rowset=256, dop=2
|
||||
2 - output([a.c2 + 1 + a.c1], [a.c1], [a.c2]), filter(nil), rowset=256, sort_keys([a.c2 + 1 + a.c1, ASC])
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2 + a.c1)]), filter(nil), rowset=256
|
||||
sort_keys([a.c2 + 1 + a.c1, ASC])
|
||||
1 - output([a.c2 + 1 + a.c1], [INTERNAL_FUNCTION(a.c1, a.c2 + a.c1)]), filter(nil), rowset=256
|
||||
dop=2
|
||||
2 - output([a.c2 + 1 + a.c1], [a.c1], [a.c2]), filter(nil), rowset=256
|
||||
sort_keys([a.c2 + 1 + a.c1, ASC])
|
||||
3 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
4 - output([a.c1], [a.c2]), filter(nil), rowset=256,
|
||||
4 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
access([a.c1], [a.c2]), partitions(p[0-4])
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.c1]), range(MIN ; MAX)always true
|
||||
select /*+ parallel(2) NO_USE_HASH_AGGREGATION */ a.c1,a.c2+a.c1 from t3 a group by a.c1,a.c2 order by a.c2+1+a.c1;
|
||||
+----+-----------+
|
||||
| c1 | a.c2+a.c1 |
|
||||
@ -131,23 +136,30 @@ Query Plan
|
||||
|8 | PX PARTITION ITERATOR | |
|
||||
|9 | TABLE SCAN |b |
|
||||
============================================
|
||||
|
||||
Outputs & filters:
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256, sort_keys([a.c1, ASC], [a.c2, ASC])
|
||||
1 - output([a.c1], [a.c2], [INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256, dop=2
|
||||
2 - output([a.c1], [a.c2]), filter(nil), rowset=256, sort_keys([a.c1, ASC], [a.c2, ASC])
|
||||
3 - output([a.c1], [a.c2]), filter(nil), rowset=256,
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256
|
||||
sort_keys([a.c1, ASC], [a.c2, ASC])
|
||||
1 - output([a.c1], [a.c2], [INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256
|
||||
dop=2
|
||||
2 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
sort_keys([a.c1, ASC], [a.c2, ASC])
|
||||
3 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
equal_conds([a.c2 = b.c1]), other_conds(nil)
|
||||
4 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
5 - (#keys=1, [a.c2]), output([a.c1], [a.c2]), filter(nil), rowset=256, dop=2
|
||||
5 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
(#keys=1, [a.c2]), dop=2
|
||||
6 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
7 - output([a.c1], [a.c2]), filter(nil), rowset=256,
|
||||
7 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
access([a.c1], [a.c2]), partitions(p[0-4])
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.c1]), range(MIN ; MAX)always true
|
||||
8 - output([b.c1]), filter(nil), rowset=256
|
||||
9 - output([b.c1]), filter(nil), rowset=256,
|
||||
affinitize
|
||||
9 - output([b.c1]), filter(nil), rowset=256
|
||||
access([b.c1]), partitions(p[0-4])
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([b.c1]), range(MIN ; MAX)always true
|
||||
select /*+ parallel(2) pq_distribute(a hash hash) NO_USE_HASH_AGGREGATION */ a.c1,a.c2 from t3 a right outer join t3 b on a.c2=b.c1 order by a.c1,a.c2;
|
||||
+----+------+
|
||||
| c1 | c2 |
|
||||
@ -177,23 +189,29 @@ Query Plan
|
||||
|8 | PX BLOCK ITERATOR | |
|
||||
|9 | TABLE SCAN |b |
|
||||
===============================================
|
||||
|
||||
Outputs & filters:
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256, sort_keys([a.c1, ASC], [a.c2 + 2, ASC])
|
||||
1 - output([a.c1], [a.c2 + 2], [INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256, dop=2
|
||||
2 - output([a.c1], [a.c2 + 2], [a.c2]), filter(nil), rowset=256, sort_keys([a.c1, ASC], [a.c2 + 2, ASC])
|
||||
3 - output([a.c1], [a.c2]), filter(nil), rowset=256,
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256
|
||||
sort_keys([a.c1, ASC], [a.c2 + 2, ASC])
|
||||
1 - output([a.c1], [a.c2 + 2], [INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256
|
||||
dop=2
|
||||
2 - output([a.c1], [a.c2 + 2], [a.c2]), filter(nil), rowset=256
|
||||
sort_keys([a.c1, ASC], [a.c2 + 2, ASC])
|
||||
3 - output([a.c1], [a.c2 + 2], [a.c2]), filter(nil), rowset=256
|
||||
equal_conds([a.c2 + 2 = b.c1 + 1]), other_conds(nil)
|
||||
4 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
5 - output([a.c1], [a.c2]), filter(nil), rowset=256, dop=2
|
||||
5 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
dop=2
|
||||
6 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
7 - output([a.c1], [a.c2]), filter(nil), rowset=256,
|
||||
7 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
access([a.c1], [a.c2]), partitions(p[0-4])
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.c1]), range(MIN ; MAX)always true
|
||||
8 - output([b.c1]), filter(nil), rowset=256
|
||||
9 - output([b.c1]), filter(nil), rowset=256,
|
||||
9 - output([b.c1]), filter(nil), rowset=256
|
||||
access([b.c1]), partitions(p[0-4])
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([b.c1]), range(MIN ; MAX)always true
|
||||
select /*+ parallel(2) pq_distribute(a hash hash) NO_USE_HASH_AGGREGATION */ a.c1,a.c2 from t3 a right outer join t3 b on a.c2+2=b.c1+1 order by a.c1,a.c2+2;
|
||||
+----+------+
|
||||
| c1 | c2 |
|
||||
@ -223,23 +241,30 @@ Query Plan
|
||||
|8 | PX PARTITION ITERATOR | |
|
||||
|9 | TABLE SCAN |b |
|
||||
============================================
|
||||
|
||||
Outputs & filters:
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256, sort_keys([a.c1, ASC], [a.c2 + 2, ASC])
|
||||
1 - output([a.c1], [a.c2 + 2], [INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256, dop=2
|
||||
2 - output([a.c1], [a.c2 + 2], [a.c2]), filter(nil), rowset=256, sort_keys([a.c1, ASC], [a.c2 + 2, ASC])
|
||||
3 - output([a.c1], [a.c2]), filter(nil), rowset=256,
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256
|
||||
sort_keys([a.c1, ASC], [a.c2 + 2, ASC])
|
||||
1 - output([a.c1], [a.c2 + 2], [INTERNAL_FUNCTION(a.c1, a.c2)]), filter(nil), rowset=256
|
||||
dop=2
|
||||
2 - output([a.c1], [a.c2 + 2], [a.c2]), filter(nil), rowset=256
|
||||
sort_keys([a.c1, ASC], [a.c2 + 2, ASC])
|
||||
3 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
equal_conds([abs(cast(a.c2, BIGINT(-1, 0))) + 2 = b.c1]), other_conds(nil)
|
||||
4 - output([a.c1], [a.c2], [abs(cast(a.c2, BIGINT(-1, 0))) + 2]), filter(nil), rowset=256
|
||||
5 - (#keys=1, [abs(cast(a.c2, BIGINT(-1, 0))) + 2]), output([a.c1], [a.c2], [abs(cast(a.c2, BIGINT(-1, 0))) + 2]), filter(nil), rowset=256, dop=2
|
||||
5 - output([a.c1], [a.c2], [abs(cast(a.c2, BIGINT(-1, 0))) + 2]), filter(nil), rowset=256
|
||||
(#keys=1, [abs(cast(a.c2, BIGINT(-1, 0))) + 2]), dop=2
|
||||
6 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
7 - output([a.c1], [a.c2]), filter(nil), rowset=256,
|
||||
7 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
access([a.c1], [a.c2]), partitions(p[0-4])
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.c1]), range(MIN ; MAX)always true
|
||||
8 - output([b.c1]), filter(nil), rowset=256
|
||||
9 - output([b.c1]), filter(nil), rowset=256,
|
||||
affinitize
|
||||
9 - output([b.c1]), filter(nil), rowset=256
|
||||
access([b.c1]), partitions(p[0-4])
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([b.c1]), range(MIN ; MAX)always true
|
||||
select /*+ parallel(2) pq_distribute(a hash hash) NO_USE_HASH_AGGREGATION */ a.c1,a.c2 from t3 a right outer join t3 b on abs(a.c2)+2=b.c1 order by a.c1,a.c2+2;
|
||||
+----+------+
|
||||
| c1 | c2 |
|
||||
@ -272,23 +297,30 @@ Query Plan
|
||||
|8 | PX BLOCK ITERATOR | |
|
||||
|9 | TABLE SCAN |a |
|
||||
============================================
|
||||
|
||||
Outputs & filters:
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2, b.c1, b.c2)]), filter(nil), rowset=256, sort_keys([a.c1, ASC], [b.c1, ASC])
|
||||
1 - output([a.c1], [b.c1], [INTERNAL_FUNCTION(a.c1, a.c2, b.c1, b.c2)]), filter(nil), rowset=256, dop=2
|
||||
2 - output([a.c1], [b.c1], [b.c2], [a.c2]), filter(nil), rowset=256, sort_keys([a.c1, ASC], [b.c1, ASC])
|
||||
3 - output([a.c1], [b.c1], [b.c2], [a.c2]), filter(nil), rowset=256,
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2, b.c1, b.c2)]), filter(nil), rowset=256
|
||||
sort_keys([a.c1, ASC], [b.c1, ASC])
|
||||
1 - output([a.c1], [b.c1], [INTERNAL_FUNCTION(a.c1, a.c2, b.c1, b.c2)]), filter(nil), rowset=256
|
||||
dop=2
|
||||
2 - output([a.c1], [b.c1], [b.c2], [a.c2]), filter(nil), rowset=256
|
||||
sort_keys([a.c1, ASC], [b.c1, ASC])
|
||||
3 - output([a.c1], [b.c1], [b.c2], [a.c2]), filter(nil), rowset=256
|
||||
equal_conds([a.c1 = b.c2]), other_conds(nil)
|
||||
4 - output([b.c2], [b.c1]), filter(nil), rowset=256
|
||||
5 - output([b.c2], [b.c1]), filter(nil), rowset=256,
|
||||
affinitize
|
||||
5 - output([b.c2], [b.c1]), filter(nil), rowset=256
|
||||
access([b.c2], [b.c1]), partitions(p[0-5])
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([b.__pk_increment]), range(MIN ; MAX)always true
|
||||
6 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
7 - (#keys=1, [a.c1]), output([a.c1], [a.c2]), filter(nil), rowset=256, dop=2
|
||||
7 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
(#keys=1, [a.c1]), dop=2
|
||||
8 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
9 - output([a.c1], [a.c2]), filter(nil), rowset=256,
|
||||
9 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
access([a.c1], [a.c2]), partitions(p[0-4])
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.__pk_increment]), range(MIN ; MAX)always true
|
||||
select /*+ parallel(2) pq_distribute(b broadcast none) */ * from t1 a, t2 b where a.c1=b.c2 order by a.c1,b.c1;
|
||||
+------+------+------+------+
|
||||
| c1 | c2 | c1 | c2 |
|
||||
@ -317,23 +349,29 @@ Query Plan
|
||||
|8 | PX BLOCK ITERATOR | |
|
||||
|9 | TABLE SCAN |a |
|
||||
===============================================
|
||||
|
||||
Outputs & filters:
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2, b.c1, b.c2)]), filter(nil), rowset=256, sort_keys([a.c1, ASC], [b.c1 + 2, ASC])
|
||||
1 - output([a.c1], [b.c1 + 2], [INTERNAL_FUNCTION(a.c1, a.c2, b.c1, b.c2)]), filter(nil), rowset=256, dop=2
|
||||
2 - output([a.c1], [b.c1 + 2], [b.c1], [b.c2], [a.c2]), filter(nil), rowset=256, sort_keys([a.c1, ASC], [b.c1 + 2, ASC])
|
||||
3 - output([a.c1], [b.c1], [b.c2], [a.c2]), filter(nil), rowset=256,
|
||||
0 - output([INTERNAL_FUNCTION(a.c1, a.c2, b.c1, b.c2)]), filter(nil), rowset=256
|
||||
sort_keys([a.c1, ASC], [b.c1 + 2, ASC])
|
||||
1 - output([a.c1], [b.c1 + 2], [INTERNAL_FUNCTION(a.c1, a.c2, b.c1, b.c2)]), filter(nil), rowset=256
|
||||
dop=2
|
||||
2 - output([a.c1], [b.c1 + 2], [b.c1], [b.c2], [a.c2]), filter(nil), rowset=256
|
||||
sort_keys([a.c1, ASC], [b.c1 + 2, ASC])
|
||||
3 - output([a.c1], [b.c1], [b.c2], [a.c2]), filter(nil), rowset=256
|
||||
equal_conds([a.c1 + 2 = b.c2 + 1]), other_conds(nil)
|
||||
4 - output([b.c1], [b.c2]), filter(nil), rowset=256
|
||||
5 - output([b.c1], [b.c2]), filter(nil), rowset=256, dop=2
|
||||
5 - output([b.c1], [b.c2]), filter(nil), rowset=256
|
||||
dop=2
|
||||
6 - output([b.c2], [b.c1]), filter(nil), rowset=256
|
||||
7 - output([b.c2], [b.c1]), filter(nil), rowset=256,
|
||||
7 - output([b.c2], [b.c1]), filter(nil), rowset=256
|
||||
access([b.c2], [b.c1]), partitions(p[0-5])
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([b.__pk_increment]), range(MIN ; MAX)always true
|
||||
8 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
9 - output([a.c1], [a.c2]), filter(nil), rowset=256,
|
||||
9 - output([a.c1], [a.c2]), filter(nil), rowset=256
|
||||
access([a.c1], [a.c2]), partitions(p[0-4])
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.__pk_increment]), range(MIN ; MAX)always true
|
||||
select /*+ parallel(2) pq_distribute(b broadcast none) */ * from t1 a, t2 b where a.c1+2=b.c2 + 1 order by a.c1,b.c1+2;
|
||||
+------+------+------+------+
|
||||
| c1 | c2 | c1 | c2 |
|
||||
@ -364,27 +402,34 @@ Query Plan
|
||||
|11| PX BLOCK ITERATOR | |
|
||||
|12| TABLE SCAN |b |
|
||||
=============================================
|
||||
|
||||
Outputs & filters:
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(b.c2, T_FUN_SUM(a.c1))]), filter(nil), rowset=256, sort_keys([b.c2, ASC], [T_FUN_SUM(a.c1), ASC])
|
||||
1 - output([b.c2], [T_FUN_SUM(a.c1)], [INTERNAL_FUNCTION(b.c2, T_FUN_SUM(a.c1))]), filter(nil), rowset=256, dop=2
|
||||
2 - output([b.c2], [T_FUN_SUM(a.c1)]), filter(nil), rowset=256,
|
||||
0 - output([INTERNAL_FUNCTION(b.c2, T_FUN_SUM(a.c1))]), filter(nil), rowset=256
|
||||
sort_keys([b.c2, ASC], [T_FUN_SUM(a.c1), ASC])
|
||||
1 - output([b.c2], [T_FUN_SUM(a.c1)], [INTERNAL_FUNCTION(b.c2, T_FUN_SUM(a.c1))]), filter(nil), rowset=256
|
||||
dop=2
|
||||
2 - output([b.c2], [T_FUN_SUM(a.c1)]), filter(nil), rowset=256
|
||||
group([b.c2]), agg_func([T_FUN_SUM(a.c1)])
|
||||
3 - output([b.c2], [a.c1]), filter(nil), rowset=256, sort_keys([b.c2, ASC])
|
||||
4 - output([b.c2], [a.c1]), filter(nil), rowset=256,
|
||||
3 - output([b.c2], [a.c1]), filter(nil), rowset=256
|
||||
sort_keys([b.c2, ASC])
|
||||
4 - output([b.c2], [a.c1]), filter(nil), rowset=256
|
||||
equal_conds([a.c1 = b.c2]), other_conds(nil)
|
||||
5 - output([a.c1]), filter(nil), rowset=256
|
||||
6 - (#keys=1, [a.c1]), output([a.c1]), filter(nil), rowset=256, dop=2
|
||||
6 - output([a.c1]), filter(nil), rowset=256
|
||||
(#keys=1, [a.c1]), dop=2
|
||||
7 - output([a.c1]), filter(nil), rowset=256
|
||||
8 - output([a.c1]), filter(nil), rowset=256,
|
||||
8 - output([a.c1]), filter(nil), rowset=256
|
||||
access([a.c1]), partitions(p0)
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.c1]), range(MIN ; MAX)always true
|
||||
9 - output([b.c2]), filter(nil), rowset=256
|
||||
10 - (#keys=1, [b.c2]), output([b.c2]), filter(nil), rowset=256, dop=2
|
||||
11 - output([b.c2]), filter(nil), rowset=256
|
||||
12 - output([b.c2]), filter(nil), rowset=256,
|
||||
10 - output([b.c2]), filter(nil), rowset=256
|
||||
(#keys=1, [b.c2]), dop=2
|
||||
11 - output([b.c2]), filter(nil), rowset=256
|
||||
12 - output([b.c2]), filter(nil), rowset=256
|
||||
access([b.c2]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([b.c1]), range(MIN ; MAX)always true
|
||||
select /*+ use_px parallel(2) */ c2,sum(c1) from (select a.c1,b.c2 from t5 a , t5 b where a.c1=b.c2) group by c2 order by 1,2;
|
||||
+------+---------+
|
||||
| c2 | sum(c1) |
|
||||
|
||||
@ -10,17 +10,15 @@ set @@ob_enable_plan_cache = 0;
|
||||
// 所有带参数的case表达式都被转为不带参数的case表达式
|
||||
EXPLAIN select case 1 when 1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN 1 = 1 THEN 'a' WHEN 1 = 2 THEN 'b' ELSE 'c' END]), filter(nil)
|
||||
values({CASE WHEN 1 = 1 THEN 'a' WHEN 1 = 2 THEN 'b' ELSE 'c' END})
|
||||
|
||||
select case 1 when 1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
+-----------------------------------------------------+
|
||||
| case 1 when 1 then 'a' when 2 then 'b' else 'c' end |
|
||||
@ -30,17 +28,15 @@ select case 1 when 1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
// 应该命中else expr
|
||||
EXPLAIN select case 100 when 1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN 100 = 1 THEN 'a' WHEN 100 = 2 THEN 'b' ELSE 'c' END]), filter(nil)
|
||||
values({CASE WHEN 100 = 1 THEN 'a' WHEN 100 = 2 THEN 'b' ELSE 'c' END})
|
||||
|
||||
select case 100 when 1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
+-------------------------------------------------------+
|
||||
| case 100 when 1 then 'a' when 2 then 'b' else 'c' end |
|
||||
@ -52,17 +48,15 @@ select case 100 when 1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
// 1和'1'的类型不一致,会被加上cast,都被转为decimal再进行比较,返回'a'
|
||||
EXPLAIN select case 1 when '1' then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN cast(1, DECIMAL(1, 0)) = cast('1', DECIMAL(1, -1)) THEN 'a' WHEN 1 = 2 THEN 'b' ELSE 'c' END]), filter(nil)
|
||||
values({CASE WHEN cast(1, DECIMAL(1, 0)) = cast('1', DECIMAL(1, -1)) THEN 'a' WHEN 1 = 2 THEN 'b' ELSE 'c' END})
|
||||
|
||||
select case 1 when '1' then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
+-------------------------------------------------------+
|
||||
| case 1 when '1' then 'a' when 2 then 'b' else 'c' end |
|
||||
@ -72,17 +66,15 @@ select case 1 when '1' then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
// 第二个then 应该要加cast,返回'a'
|
||||
EXPLAIN select case 1 when 1 then 'a' when 2 then 'b' else 3 end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN 1 = 1 THEN 'a' WHEN 1 = 2 THEN 'b' ELSE cast(3, VARCHAR(1048576)) END]), filter(nil)
|
||||
values({CASE WHEN 1 = 1 THEN 'a' WHEN 1 = 2 THEN 'b' ELSE cast(3, VARCHAR(1048576)) END})
|
||||
|
||||
select case 1 when 1 then 'a' when 2 then 'b' else 3 end from dual;
|
||||
+---------------------------------------------------+
|
||||
| case 1 when 1 then 'a' when 2 then 'b' else 3 end |
|
||||
@ -95,17 +87,15 @@ select case 1 when 1 then 'a' when 2 then 'b' else 3 end from dual;
|
||||
// 应该返回'a'
|
||||
EXPLAIN select case when 1=1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN 1 = 1 THEN 'a' WHEN 2 THEN 'b' ELSE 'c' END]), filter(nil)
|
||||
values({CASE WHEN 1 = 1 THEN 'a' WHEN 2 THEN 'b' ELSE 'c' END})
|
||||
|
||||
select case when 1=1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
+-----------------------------------------------------+
|
||||
| case when 1=1 then 'a' when 2 then 'b' else 'c' end |
|
||||
@ -115,17 +105,15 @@ select case when 1=1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
// 应该返回'c'
|
||||
EXPLAIN select case when 0=1 then 'a' when 0.0 then 'b' else 'c' end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN 0 = 1 THEN 'a' WHEN 0.0 THEN 'b' ELSE 'c' END]), filter(nil)
|
||||
values({CASE WHEN 0 = 1 THEN 'a' WHEN 0.0 THEN 'b' ELSE 'c' END})
|
||||
|
||||
select case when 0=1 then 'a' when 0.0 then 'b' else 'c' end from dual;
|
||||
+-------------------------------------------------------+
|
||||
| case when 0=1 then 'a' when 0.0 then 'b' else 'c' end |
|
||||
@ -136,17 +124,15 @@ select case when 0=1 then 'a' when 0.0 then 'b' else 'c' end from dual;
|
||||
// 应该返回'a',且0='1'中要加cast
|
||||
EXPLAIN select case when 1='1' then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN cast(1, DECIMAL(1, 0)) = cast('1', DECIMAL(1, -1)) THEN 'a' WHEN 2 THEN 'b' ELSE 'c' END]), filter(nil)
|
||||
values({CASE WHEN cast(1, DECIMAL(1, 0)) = cast('1', DECIMAL(1, -1)) THEN 'a' WHEN 2 THEN 'b' ELSE 'c' END})
|
||||
|
||||
select case when 1='1' then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
+-------------------------------------------------------+
|
||||
| case when 1='1' then 'a' when 2 then 'b' else 'c' end |
|
||||
@ -156,17 +142,15 @@ select case when 1='1' then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
// 应该返回'c',且0='1'中要加cast
|
||||
EXPLAIN select case when 0='1' then 'a' when 0.0 then 'b' else 'c' end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN cast(0, DECIMAL(1, 0)) = cast('1', DECIMAL(1, -1)) THEN 'a' WHEN 0.0 THEN 'b' ELSE 'c' END]), filter(nil)
|
||||
values({CASE WHEN cast(0, DECIMAL(1, 0)) = cast('1', DECIMAL(1, -1)) THEN 'a' WHEN 0.0 THEN 'b' ELSE 'c' END})
|
||||
|
||||
select case when 0='1' then 'a' when 0.0 then 'b' else 'c' end from dual;
|
||||
+---------------------------------------------------------+
|
||||
| case when 0='1' then 'a' when 0.0 then 'b' else 'c' end |
|
||||
@ -186,17 +170,17 @@ alter system flush plan cache global;
|
||||
// 测试int的normal case,应该返回'a'
|
||||
EXPLAIN select case col_int when 1 then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN t1.col_int = 1 THEN 'a' WHEN t1.col_int = 2 THEN 'b' ELSE 'c' END]), filter(nil), rowset=256,
|
||||
0 - output([CASE WHEN t1.col_int = 1 THEN 'a' WHEN t1.col_int = 2 THEN 'b' ELSE 'c' END]), filter(nil), rowset=256
|
||||
access([t1.col_int]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select case col_int when 1 then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
+-----------------------------------------------------------+
|
||||
| case col_int when 1 then 'a' when 2 then 'b' else 'c' end |
|
||||
@ -206,17 +190,18 @@ select case col_int when 1 then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
// 测试int需要加cast的情况,第一个when需要加cast, 第二个when不需要
|
||||
EXPLAIN select case col_int when '1' then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN cast(t1.col_int, DECIMAL(11, 0)) = cast('1', DECIMAL(1, -1)) THEN 'a' WHEN t1.col_int = 2 THEN 'b' ELSE 'c' END]), filter(nil), rowset=256,
|
||||
0 - output([CASE WHEN cast(t1.col_int, DECIMAL(11, 0)) = cast('1', DECIMAL(1, -1)) THEN 'a' WHEN t1.col_int = 2 THEN 'b' ELSE 'c' END]), filter(nil),
|
||||
rowset=256
|
||||
access([t1.col_int]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select case col_int when '1' then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
+-------------------------------------------------------------+
|
||||
| case col_int when '1' then 'a' when 2 then 'b' else 'c' end |
|
||||
@ -226,17 +211,17 @@ select case col_int when '1' then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
// 测试null的情况,应该返回'c',而且没有cast出现
|
||||
EXPLAIN select case col_null when 1 then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN t1.col_null = 1 THEN 'a' WHEN t1.col_null = 2 THEN 'b' ELSE 'c' END]), filter(nil), rowset=256,
|
||||
0 - output([CASE WHEN t1.col_null = 1 THEN 'a' WHEN t1.col_null = 2 THEN 'b' ELSE 'c' END]), filter(nil), rowset=256
|
||||
access([t1.col_null]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select case col_null when 1 then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
+------------------------------------------------------------+
|
||||
| case col_null when 1 then 'a' when 2 then 'b' else 'c' end |
|
||||
@ -248,17 +233,15 @@ select case col_null when 1 then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
// 应该返回1, MySQL没有把空串看成NULL
|
||||
EXPLAIN select case '' when '' then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN '' = '' THEN cast(1, VARCHAR(1048576)) WHEN '' = 'here' THEN cast(2, VARCHAR(1048576)) ELSE 'hh' END]), filter(nil)
|
||||
values({CASE WHEN '' = '' THEN cast(1, VARCHAR(1048576)) WHEN '' = 'here' THEN cast(2, VARCHAR(1048576)) ELSE 'hh' END})
|
||||
|
||||
select case '' when '' then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
+---------------------------------------------------------+
|
||||
| case '' when '' then 1 when 'here' then 2 else 'hh' end |
|
||||
@ -268,17 +251,16 @@ select case '' when '' then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
// 应该返回'hh'
|
||||
EXPLAIN select case NULL when NULL then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN NULL = NULL THEN cast(1, VARCHAR(1048576)) WHEN cast(NULL, VARCHAR(1048576)) = 'here' THEN cast(2, VARCHAR(1048576)) ELSE 'hh' END]), filter(nil)
|
||||
0 - output([CASE WHEN NULL = NULL THEN cast(1, VARCHAR(1048576)) WHEN cast(NULL, VARCHAR(1048576)) = 'here' THEN cast(2, VARCHAR(1048576)) ELSE 'hh' END]),
|
||||
filter(nil)
|
||||
values({CASE WHEN NULL = NULL THEN cast(1, VARCHAR(1048576)) WHEN cast(NULL, VARCHAR(1048576)) = 'here' THEN cast(2, VARCHAR(1048576)) ELSE 'hh' END})
|
||||
|
||||
select case NULL when NULL then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
+-------------------------------------------------------------+
|
||||
| case NULL when NULL then 1 when 'here' then 2 else 'hh' end |
|
||||
@ -288,17 +270,15 @@ select case NULL when NULL then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
// 应该返回1, MySQL没有把空串看成NULL
|
||||
EXPLAIN select case when '' = '' then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN '' = '' THEN cast(1, VARCHAR(1048576)) WHEN cast('here', DOUBLE(-1, -1)) THEN cast(2, VARCHAR(1048576)) ELSE 'hh' END]), filter(nil)
|
||||
values({CASE WHEN '' = '' THEN cast(1, VARCHAR(1048576)) WHEN cast('here', DOUBLE(-1, -1)) THEN cast(2, VARCHAR(1048576)) ELSE 'hh' END})
|
||||
|
||||
select case when '' = '' then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
+-----------------------------------------------------------+
|
||||
| case when '' = '' then 1 when 'here' then 2 else 'hh' end |
|
||||
@ -308,17 +288,15 @@ select case when '' = '' then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
// 应该返回'hh', 因为'here'cast为double会失败,返回值应该是0
|
||||
EXPLAIN select case when NULL=NULL then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN NULL = NULL THEN cast(1, VARCHAR(1048576)) WHEN cast('here', DOUBLE(-1, -1)) THEN cast(2, VARCHAR(1048576)) ELSE 'hh' END]), filter(nil)
|
||||
values({CASE WHEN NULL = NULL THEN cast(1, VARCHAR(1048576)) WHEN cast('here', DOUBLE(-1, -1)) THEN cast(2, VARCHAR(1048576)) ELSE 'hh' END})
|
||||
|
||||
select case when NULL=NULL then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
+-------------------------------------------------------------+
|
||||
| case when NULL=NULL then 1 when 'here' then 2 else 'hh' end |
|
||||
@ -333,37 +311,37 @@ drop table t1;
|
||||
create table t1 (a varchar(100) collate utf8_general_ci, cond1 varchar(100) collate utf8_bin, cond2 varchar(100) collate utf8_general_ci);
|
||||
EXPLAIN insert into t1 values('cond', 'COND', 'COND');
|
||||
Query Plan
|
||||
===========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-------------------------------------------
|
||||
|0 |DISTRIBUTED INSERT| |1 |13 |
|
||||
|1 | EXPRESSION | |1 |1 |
|
||||
===========================================
|
||||
|
||||
Outputs & filters:
|
||||
==================================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
--------------------------------------------------
|
||||
|0 |DISTRIBUTED INSERT| |1 |13 |
|
||||
|1 | EXPRESSION | |1 |1 |
|
||||
==================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output(nil), filter(nil),
|
||||
0 - output(nil), filter(nil)
|
||||
columns([{t1: ({t1: (t1.__pk_increment, t1.a, t1.cond1, t1.cond2)})}]),
|
||||
column_values([T_HIDDEN_PK], [column_conv(VARCHAR,utf8mb4_general_ci,length:100,NULL,__values.a)], [column_conv(VARCHAR,utf8mb4_bin,length:100,NULL,__values.cond1)], [column_conv(VARCHAR,utf8mb4_general_ci,length:100,NULL,__values.cond2)])
|
||||
column_values([T_HIDDEN_PK], [column_conv(VARCHAR,utf8mb4_general_ci,length:100,NULL,__values.a)], [column_conv(VARCHAR,utf8mb4_bin,length:100,NULL,__values.cond1)],
|
||||
[column_conv(VARCHAR,utf8mb4_general_ci,length:100,NULL,__values.cond2)])
|
||||
1 - output([__values.a], [__values.cond1], [__values.cond2]), filter(nil)
|
||||
values({'cond', 'COND', 'COND'})
|
||||
|
||||
insert into t1 values('cond', 'COND', 'COND');
|
||||
explain_protocol: 2
|
||||
// 返回Null,a和cond1以及a和cond2比较都会使用utf8_bin作为collation type(因为有aggregate collation的过程)
|
||||
EXPLAIN select case a when cond1 then '1' when cond2 then '2' end from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN cast(t1.a, VARCHAR(1048576)) = t1.cond1 THEN '1' WHEN cast(t1.a, VARCHAR(1048576)) = cast(t1.cond2, VARCHAR(1048576)) THEN '2' ELSE NULL END]), filter(nil), rowset=256,
|
||||
0 - output([CASE WHEN cast(t1.a, VARCHAR(1048576)) = t1.cond1 THEN '1' WHEN cast(t1.a, VARCHAR(1048576)) = cast(t1.cond2, VARCHAR(1048576)) THEN '2' ELSE
|
||||
NULL END]), filter(nil), rowset=256
|
||||
access([t1.a], [t1.cond1], [t1.cond2]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select case a when cond1 then '1' when cond2 then '2' end from t1;
|
||||
+----------------------------------------------------+
|
||||
| case a when cond1 then '1' when cond2 then '2' end |
|
||||
@ -373,17 +351,17 @@ select case a when cond1 then '1' when cond2 then '2' end from t1;
|
||||
// 返回'neq', a和cond1比较使用的是utf8_bin
|
||||
EXPLAIN select case a when cond1 then 'eq' else 'neq' end from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN cast(t1.a, VARCHAR(1048576)) = t1.cond1 THEN 'eq' ELSE 'neq' END]), filter(nil), rowset=256,
|
||||
0 - output([CASE WHEN cast(t1.a, VARCHAR(1048576)) = t1.cond1 THEN 'eq' ELSE 'neq' END]), filter(nil), rowset=256
|
||||
access([t1.a], [t1.cond1]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select case a when cond1 then 'eq' else 'neq' end from t1;
|
||||
+--------------------------------------------+
|
||||
| case a when cond1 then 'eq' else 'neq' end |
|
||||
@ -393,17 +371,17 @@ select case a when cond1 then 'eq' else 'neq' end from t1;
|
||||
// 返回'eq', a和cond1比较使用的是utf8_general_ci
|
||||
EXPLAIN select case a when cond2 then 'eq' else 'neq' end from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN t1.a = t1.cond2 THEN 'eq' ELSE 'neq' END]), filter(nil), rowset=256,
|
||||
0 - output([CASE WHEN t1.a = t1.cond2 THEN 'eq' ELSE 'neq' END]), filter(nil), rowset=256
|
||||
access([t1.a], [t1.cond2]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select case a when cond2 then 'eq' else 'neq' end from t1;
|
||||
+--------------------------------------------+
|
||||
| case a when cond2 then 'eq' else 'neq' end |
|
||||
@ -413,17 +391,17 @@ select case a when cond2 then 'eq' else 'neq' end from t1;
|
||||
// arg case子节点也是arg case的情况测试,应该都被改为case expr(应该返回'ok')
|
||||
EXPLAIN select case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([CASE WHEN CASE WHEN t1.a = 'cond' THEN 'eq' ELSE 'neq' END = 'eq' THEN 'ok' ELSE 'not ok' END]), filter(nil), rowset=256,
|
||||
0 - output([CASE WHEN CASE WHEN t1.a = 'cond' THEN 'eq' ELSE 'neq' END = 'eq' THEN 'ok' ELSE 'not ok' END]), filter(nil), rowset=256
|
||||
access([t1.a]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end from t1;
|
||||
+----------------------------------------------------------------------------------------+
|
||||
| case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end |
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -14,26 +14,26 @@ set @@ob_enable_plan_cache = 0;
|
||||
|
||||
explain select c2, sum(c1) from (select distinct c2, c1 from t1) x group by c2;
|
||||
Query Plan
|
||||
========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
----------------------------------------
|
||||
|0 |HASH GROUP BY | |5 |5 |
|
||||
|1 | SUBPLAN SCAN |x |5 |4 |
|
||||
|2 | HASH DISTINCT| |5 |4 |
|
||||
|3 | TABLE SCAN |t1 |5 |2 |
|
||||
========================================
|
||||
|
||||
Outputs & filters:
|
||||
===============================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
-----------------------------------------------
|
||||
|0 |HASH GROUP BY | |5 |5 |
|
||||
|1 | SUBPLAN SCAN |x |5 |4 |
|
||||
|2 | HASH DISTINCT| |5 |4 |
|
||||
|3 | TABLE SCAN |t1 |5 |2 |
|
||||
===============================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([x.c2], [T_FUN_SUM(x.c1)]), filter(nil), rowset=256,
|
||||
0 - output([x.c2], [T_FUN_SUM(x.c1)]), filter(nil), rowset=256
|
||||
group([x.c2]), agg_func([T_FUN_SUM(x.c1)])
|
||||
1 - output([x.c2], [x.c1]), filter(nil), rowset=256,
|
||||
1 - output([x.c2], [x.c1]), filter(nil), rowset=256
|
||||
access([x.c2], [x.c1])
|
||||
2 - output([t1.c2], [t1.c1]), filter(nil), rowset=256,
|
||||
2 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
|
||||
distinct([t1.c2], [t1.c1])
|
||||
3 - output([t1.c2], [t1.c1]), filter(nil), rowset=256,
|
||||
3 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
|
||||
access([t1.c2], [t1.c1]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select c2, sum(c1) from (select distinct c2, c1 from t1) x group by c2;
|
||||
+------+---------+
|
||||
| c2 | sum(c1) |
|
||||
@ -45,26 +45,26 @@ select c2, sum(c1) from (select distinct c2, c1 from t1) x group by c2;
|
||||
|
||||
explain select c2, sum(c1 + c2) from (select distinct c2, c1 from t1) x group by c2;
|
||||
Query Plan
|
||||
========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
----------------------------------------
|
||||
|0 |HASH GROUP BY | |5 |5 |
|
||||
|1 | SUBPLAN SCAN |x |5 |4 |
|
||||
|2 | HASH DISTINCT| |5 |4 |
|
||||
|3 | TABLE SCAN |t1 |5 |2 |
|
||||
========================================
|
||||
|
||||
Outputs & filters:
|
||||
===============================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
-----------------------------------------------
|
||||
|0 |HASH GROUP BY | |5 |5 |
|
||||
|1 | SUBPLAN SCAN |x |5 |4 |
|
||||
|2 | HASH DISTINCT| |5 |4 |
|
||||
|3 | TABLE SCAN |t1 |5 |2 |
|
||||
===============================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([x.c2], [T_FUN_SUM(x.c1 + x.c2)]), filter(nil), rowset=256,
|
||||
0 - output([x.c2], [T_FUN_SUM(x.c1 + x.c2)]), filter(nil), rowset=256
|
||||
group([x.c2]), agg_func([T_FUN_SUM(x.c1 + x.c2)])
|
||||
1 - output([x.c2], [x.c1]), filter(nil), rowset=256,
|
||||
1 - output([x.c2], [x.c1]), filter(nil), rowset=256
|
||||
access([x.c2], [x.c1])
|
||||
2 - output([t1.c2], [t1.c1]), filter(nil), rowset=256,
|
||||
2 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
|
||||
distinct([t1.c2], [t1.c1])
|
||||
3 - output([t1.c2], [t1.c1]), filter(nil), rowset=256,
|
||||
3 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
|
||||
access([t1.c2], [t1.c1]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select c2, sum(c1 + c2) from (select distinct c2, c1 from t1) x group by c2;
|
||||
+------+--------------+
|
||||
| c2 | sum(c1 + c2) |
|
||||
@ -76,26 +76,26 @@ select c2, sum(c1 + c2) from (select distinct c2, c1 from t1) x group by c2;
|
||||
|
||||
explain select c2, sum(c1 + c2), max(c3) from (select c1, c2, c1 + 2 as c3 from (select distinct c2, c1 from t1) x ) y group by c2;
|
||||
Query Plan
|
||||
========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
----------------------------------------
|
||||
|0 |HASH GROUP BY | |5 |5 |
|
||||
|1 | SUBPLAN SCAN |x |5 |4 |
|
||||
|2 | HASH DISTINCT| |5 |4 |
|
||||
|3 | TABLE SCAN |t1 |5 |2 |
|
||||
========================================
|
||||
|
||||
Outputs & filters:
|
||||
===============================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
-----------------------------------------------
|
||||
|0 |HASH GROUP BY | |5 |5 |
|
||||
|1 | SUBPLAN SCAN |x |5 |4 |
|
||||
|2 | HASH DISTINCT| |5 |4 |
|
||||
|3 | TABLE SCAN |t1 |5 |2 |
|
||||
===============================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([x.c2], [T_FUN_SUM(x.c1 + x.c2)], [T_FUN_MAX(x.c1 + 2)]), filter(nil), rowset=256,
|
||||
0 - output([x.c2], [T_FUN_SUM(x.c1 + x.c2)], [T_FUN_MAX(x.c1 + 2)]), filter(nil), rowset=256
|
||||
group([x.c2]), agg_func([T_FUN_SUM(x.c1 + x.c2)], [T_FUN_MAX(x.c1 + 2)])
|
||||
1 - output([x.c1], [x.c2]), filter(nil), rowset=256,
|
||||
1 - output([x.c1], [x.c2]), filter(nil), rowset=256
|
||||
access([x.c1], [x.c2])
|
||||
2 - output([t1.c2], [t1.c1]), filter(nil), rowset=256,
|
||||
2 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
|
||||
distinct([t1.c2], [t1.c1])
|
||||
3 - output([t1.c2], [t1.c1]), filter(nil), rowset=256,
|
||||
3 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
|
||||
access([t1.c2], [t1.c1]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select c2, sum(c1 + c2), max(c3) from (select c1, c2, c1 + 2 as c3 from (select distinct c2, c1 from t1) x ) y group by c2;
|
||||
+------+--------------+---------+
|
||||
| c2 | sum(c1 + c2) | max(c3) |
|
||||
@ -107,17 +107,17 @@ select c2, sum(c1 + c2), max(c3) from (select c1, c2, c1 + 2 as c3 from (select
|
||||
|
||||
explain select * from t1 where c2 in (select 1 from t1);
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |1 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2]), filter([t1.c2 = 1]), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2]), filter([t1.c2 = 1]), rowset=256
|
||||
access([t1.c2], [t1.c1]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
|
||||
select * from t1 where c2 in (select 1 from t1);
|
||||
+------+------+
|
||||
| c1 | c2 |
|
||||
|
||||
@ -23,17 +23,19 @@ insert into t1 values('3', '1', '1', '1', '-1', '6', '7', '8', '9', '10', '-11',
|
||||
explain_protocol: 2
|
||||
EXPLAIN select * from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |4 |4 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |4 |4 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10], [t1.c11], [t1.c12], [t1.c13], [t1.c14], [t1.c15], [t1.c16], [t1.c17], [t1.c18], [t1.c19], [t1.c20], [t1.c21], [t1.c22]), filter(nil), rowset=256,
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10], [t1.c11], [t1.c12], [t1.c13], [t1.c14], [t1.c15], [t1.c16], [t1.c17], [t1.c18], [t1.c19], [t1.c20], [t1.c21], [t1.c22]), partitions(p0)
|
||||
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10], [t1.c11], [t1.c12], [t1.c13], [t1.c14], [t1.c15],
|
||||
[t1.c16], [t1.c17], [t1.c18], [t1.c19], [t1.c20], [t1.c21], [t1.c22]), filter(nil), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5], [t1.c6], [t1.c7], [t1.c8], [t1.c9], [t1.c10], [t1.c11], [t1.c12], [t1.c13], [t1.c14], [t1.c15],
|
||||
[t1.c16], [t1.c17], [t1.c18], [t1.c19], [t1.c20], [t1.c21], [t1.c22]), partitions(p0)
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.c1]), range(MIN ; MAX)always true
|
||||
select * from t1;
|
||||
+----+------+------+------+------+------+------+------+------+------+------+------+--------+-------+---------+--------+------+------+---------------------+---------------------+------------+---------+
|
||||
| c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 | c9 | c10 | c11 | c12 | c13 | c14 | c15 | c16 | c17 | c18 | c19 | c20 | c21 | c22 |
|
||||
|
||||
@ -20,17 +20,17 @@ set @@ob_enable_plan_cache = 0;
|
||||
explain_protocol: 2
|
||||
EXPLAIN select * from t1;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |7 |3 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |7 |3 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.c1], [t1.c2]), range(MIN,MIN ; MAX,MAX)always true
|
||||
select * from t1;
|
||||
+----+----+------+------+------------+
|
||||
| c1 | c2 | c3 | c4 | c5 |
|
||||
@ -45,17 +45,17 @@ select * from t1;
|
||||
+----+----+------+------+------------+
|
||||
EXPLAIN select * from t1 order by c1 desc, c2 desc;
|
||||
Query Plan
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1(Reverse)|7 |3 |
|
||||
==========================================
|
||||
|
||||
Outputs & filters:
|
||||
=================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
-------------------------------------------------
|
||||
|0 |TABLE SCAN|t1(Reverse)|7 |3 |
|
||||
=================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.c1], [t1.c2]), range(MIN,MIN ; MAX,MAX)always true
|
||||
select * from t1 order by c1 desc, c2 desc;
|
||||
+----+----+------+------+------------+
|
||||
| c1 | c2 | c3 | c4 | c5 |
|
||||
@ -70,17 +70,17 @@ select * from t1 order by c1 desc, c2 desc;
|
||||
+----+----+------+------+------------+
|
||||
EXPLAIN select * from t1 where c1 + c2 < 10;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |3 |3 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |3 |3 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter([t1.c1 + t1.c2 < cast(10, DECIMAL(2, 0))]), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter([t1.c1 + t1.c2 < cast(10, DECIMAL(2, 0))]), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([t1.c1], [t1.c2]), range(MIN,MIN ; MAX,MAX)always true
|
||||
select * from t1 where c1 + c2 < 10;
|
||||
+----+----+------+------+------------+
|
||||
| c1 | c2 | c3 | c4 | c5 |
|
||||
@ -92,18 +92,17 @@ select * from t1 where c1 + c2 < 10;
|
||||
+----+----+------+------+------------+
|
||||
EXPLAIN select * from t1 limit 2;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |2 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |2 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256,
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), partitions(p0),
|
||||
limit(2), offset(nil)
|
||||
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), partitions(p0)
|
||||
limit(2), offset(nil), is_index_back=false, is_global_index=false,
|
||||
range_key([t1.c1], [t1.c2]), range(MIN,MIN ; MAX,MAX)always true
|
||||
select * from t1 limit 2;
|
||||
+----+----+------+------+------------+
|
||||
| c1 | c2 | c3 | c4 | c5 |
|
||||
@ -113,17 +112,18 @@ select * from t1 limit 2;
|
||||
+----+----+------+------+------------+
|
||||
EXPLAIN select * from t1 where c1 = 5;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |2 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |2 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.c1], [t1.c2]), range(5,MIN ; 5,MAX),
|
||||
range_cond([t1.c1 = cast(5, DECIMAL(1, 0))])
|
||||
select * from t1 where c1 = 5;
|
||||
+----+----+------+------+------------+
|
||||
| c1 | c2 | c3 | c4 | c5 |
|
||||
@ -133,17 +133,18 @@ select * from t1 where c1 = 5;
|
||||
+----+----+------+------+------------+
|
||||
EXPLAIN select * from t1 where c1 = 5 or c1 = 7;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t1 |4 |2 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------
|
||||
|0 |TABLE SCAN|t1 |4 |2 |
|
||||
==========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.c1], [t1.c2]), range(5,MIN ; 5,MAX), (7,MIN ; 7,MAX),
|
||||
range_cond([t1.c1 = cast(5, DECIMAL(1, 0)) OR t1.c1 = cast(7, DECIMAL(1, 0))])
|
||||
select * from t1 where c1 = 5 or c1 = 7;
|
||||
+----+----+------+------+------------+
|
||||
| c1 | c2 | c3 | c4 | c5 |
|
||||
@ -155,17 +156,19 @@ select * from t1 where c1 = 5 or c1 = 7;
|
||||
+----+----+------+------+------------+
|
||||
EXPLAIN select * from t1 where (c1 = 2 and c2 = 4) or (c1 = 7 and c2 = 5) or (c1 = 8 and c2 = 7);
|
||||
Query Plan
|
||||
==================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
----------------------------------
|
||||
|0 |TABLE GET|t1 |3 |8 |
|
||||
==================================
|
||||
|
||||
Outputs & filters:
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
-----------------------------------------
|
||||
|0 |TABLE GET|t1 |3 |8 |
|
||||
=========================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter(nil), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.c1], [t1.c2]), range[2,4 ; 2,4], [7,5 ; 7,5], [8,7 ; 8,7],
|
||||
range_cond([(T_OP_OR, t1.c1 = cast(2, DECIMAL(1, 0)) AND t1.c2 = cast(4, DECIMAL(1, 0)), t1.c1 = cast(7, DECIMAL(1, 0)) AND t1.c2 = cast(5, DECIMAL(1,
|
||||
0)), t1.c1 = cast(8, DECIMAL(1, 0)) AND t1.c2 = cast(7, DECIMAL(1, 0)))])
|
||||
select * from t1 where (c1 = 2 and c2 = 4) or (c1 = 7 and c2 = 5) or (c1 = 8 and c2 = 7);
|
||||
+----+----+------+------+------------+
|
||||
| c1 | c2 | c3 | c4 | c5 |
|
||||
@ -176,17 +179,19 @@ select * from t1 where (c1 = 2 and c2 = 4) or (c1 = 7 and c2 = 5) or (c1 = 8 and
|
||||
|
||||
EXPLAIN select * from t1 where c2 = 2 and c1 + c2 < 10 and c4 > c3;
|
||||
Query Plan
|
||||
=====================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
============================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
--------------------------------------------
|
||||
|0 |TABLE SCAN|t1(i1)|1 |4 |
|
||||
============================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
|0 |TABLE SCAN|t1(i1)|1 |4 |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter([t1.c1 + cast(cast(2, DECIMAL(1, 0)), DECIMAL(10, 0)) < cast(10, DECIMAL(2, 0))], [t1.c4 > t1.c3]), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t1.c4], [t1.c5]), filter([t1.c1 + cast(cast(2, DECIMAL(1, 0)), DECIMAL(10, 0)) < cast(10, DECIMAL(2, 0))], [t1.c4
|
||||
> t1.c3]), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c4], [t1.c3], [t1.c5]), partitions(p0)
|
||||
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[true,false],
|
||||
range_key([t1.c2], [t1.c1]), range(2,MIN ; 2,MAX),
|
||||
range_cond([t1.c2 = cast(2, DECIMAL(1, 0))])
|
||||
select * from t1 where c2 = 2 and c1 + c2 < 10 and c4 > c3;
|
||||
+----+----+------+------+------------+
|
||||
| c1 | c2 | c3 | c4 | c5 |
|
||||
@ -197,17 +202,18 @@ select * from t1 where c2 = 2 and c1 + c2 < 10 and c4 > c3;
|
||||
|
||||
EXPLAIN select c1, c2 from t1 where c2 > 4;
|
||||
Query Plan
|
||||
=====================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
============================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
--------------------------------------------
|
||||
|0 |TABLE SCAN|t1(i1)|3 |2 |
|
||||
============================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
|0 |TABLE SCAN|t1(i1)|3 |2 |
|
||||
=====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2]), filter(nil), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2]), filter(nil), rowset=256
|
||||
access([t1.c1], [t1.c2]), partitions(p0)
|
||||
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([t1.c2], [t1.c1]), range(4,MAX ; MAX,MAX),
|
||||
range_cond([t1.c2 > cast(4, DECIMAL(1, 0))])
|
||||
select c1, c2 from t1 where c2 > 4;
|
||||
+----+----+
|
||||
| c1 | c2 |
|
||||
@ -222,38 +228,37 @@ drop table t1;
|
||||
create table t1(c1 int primary key, c2 int, c3 int, index idx(c2));
|
||||
EXPLAIN insert into t1 values(1,1,1), (2,2,2), (3,3,3), (4,4,4),(5,5,5), (6,6,6), (7,7,7);
|
||||
Query Plan
|
||||
===========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-------------------------------------------
|
||||
|0 |DISTRIBUTED INSERT| |7 |51 |
|
||||
|1 | EXPRESSION | |7 |1 |
|
||||
===========================================
|
||||
|
||||
Outputs & filters:
|
||||
==================================================
|
||||
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
|
||||
--------------------------------------------------
|
||||
|0 |DISTRIBUTED INSERT| |7 |51 |
|
||||
|1 | EXPRESSION | |7 |1 |
|
||||
==================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output(nil), filter(nil),
|
||||
0 - output(nil), filter(nil)
|
||||
columns([{t1: ({t1: (t1.c1, t1.c2, t1.c3)})}]),
|
||||
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.c1)], [column_conv(INT,PS:(11,0),NULL,__values.c2)], [column_conv(INT,PS:(11,0),NULL,__values.c3)])
|
||||
1 - output([__values.c1], [__values.c2], [__values.c3]), filter(nil)
|
||||
values({1, 1, 1}, {2, 2, 2}, {3, 3, 3}, {4, 4, 4}, {5, 5, 5}, {6, 6, 6}, {7, 7, 7})
|
||||
|
||||
insert into t1 values(1,1,1), (2,2,2), (3,3,3), (4,4,4),(5,5,5), (6,6,6), (7,7,7);
|
||||
|
||||
|
||||
# case 1: index back with before_index_back_filter
|
||||
EXPLAIN select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c2 > 1 and c1 < 4;
|
||||
Query Plan
|
||||
======================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
--------------------------------------
|
||||
|0 |TABLE SCAN|t1(idx)|1 |4 |
|
||||
======================================
|
||||
|
||||
Outputs & filters:
|
||||
=============================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
---------------------------------------------
|
||||
|0 |TABLE SCAN|t1(idx)|1 |4 |
|
||||
=============================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter([t1.c1 < 4]), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter([t1.c1 < 4]), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
|
||||
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[true],
|
||||
range_key([t1.c2], [t1.c1]), range(1,MAX ; MAX,4),
|
||||
range_cond([t1.c2 > 1])
|
||||
select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c2 > 1 and c1 < 4;
|
||||
+----+------+------+
|
||||
| c1 | c2 | c3 |
|
||||
@ -266,17 +271,18 @@ select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c2 > 1 and c1 < 4;
|
||||
# case 2: index back without before_index_back_filter
|
||||
EXPLAIN select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c2 > 1 and c3 < 4;
|
||||
Query Plan
|
||||
======================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
--------------------------------------
|
||||
|0 |TABLE SCAN|t1(idx)|1 |18 |
|
||||
======================================
|
||||
|
||||
Outputs & filters:
|
||||
=============================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
---------------------------------------------
|
||||
|0 |TABLE SCAN|t1(idx)|1 |18 |
|
||||
=============================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter([t1.c3 < 4]), rowset=256,
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter([t1.c3 < 4]), rowset=256
|
||||
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
|
||||
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([t1.c2], [t1.c1]), range(1,MAX ; MAX,MAX),
|
||||
range_cond([t1.c2 > 1])
|
||||
select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c2 > 1 and c3 < 4;
|
||||
+----+------+------+
|
||||
| c1 | c2 | c3 |
|
||||
@ -287,18 +293,17 @@ select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c2 > 1 and c3 < 4;
|
||||
|
||||
EXPLAIN select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c3 != 1 limit 2;
|
||||
Query Plan
|
||||
======================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
--------------------------------------
|
||||
|0 |TABLE SCAN|t1(idx)|2 |8 |
|
||||
======================================
|
||||
|
||||
Outputs & filters:
|
||||
=============================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
---------------------------------------------
|
||||
|0 |TABLE SCAN|t1(idx)|2 |8 |
|
||||
=============================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter([t1.c3 != 1]), rowset=256,
|
||||
access([t1.c1], [t1.c3], [t1.c2]), partitions(p0),
|
||||
limit(2), offset(nil)
|
||||
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter([t1.c3 != 1]), rowset=256
|
||||
access([t1.c1], [t1.c3], [t1.c2]), partitions(p0)
|
||||
limit(2), offset(nil), is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([t1.c2], [t1.c1]), range(MIN,MIN ; MAX,MAX)always true
|
||||
select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c3 != 1 limit 2;
|
||||
+----+------+------+
|
||||
| c1 | c2 | c3 |
|
||||
|
||||
Reference in New Issue
Block a user