Commit 2ae8dc24 authored by Igor Babaev's avatar Igor Babaev

Adjusted test results after rebase against 11.0.1

parent 12840543
...@@ -583,8 +583,7 @@ explain delete from t1 ...@@ -583,8 +583,7 @@ explain delete from t1
where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 1 PRIMARY a ALL NULL NULL NULL NULL 8 Using where; FirstMatch(t1)
2 MATERIALIZED a ALL NULL NULL NULL NULL 8
delete from t1 delete from t1
where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
select *from t1; select *from t1;
...@@ -600,8 +599,7 @@ where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3 ...@@ -600,8 +599,7 @@ where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3
order by c2; order by c2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 1 PRIMARY a ALL NULL NULL NULL NULL 8 Using where; FirstMatch(t1)
2 MATERIALIZED a ALL NULL NULL NULL NULL 8
delete from t1 delete from t1
where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3
order by c2; order by c2;
......
This diff is collapsed.
...@@ -13134,20 +13134,7 @@ EXPLAIN ...@@ -13134,20 +13134,7 @@ EXPLAIN
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 3, "select_id": 3,
<<<<<<< 2ad65c4dbcb291867725d50d1f53c8da8549afb3
"cost": "COST_REPLACED", "cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f2 < 2"
}
=======
"filesort": { "filesort": {
"sort_key": "t1.f2", "sort_key": "t1.f2",
"temporary_table": { "temporary_table": {
...@@ -13156,7 +13143,9 @@ EXPLAIN ...@@ -13156,7 +13143,9 @@ EXPLAIN
"table": { "table": {
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"loops": 1,
"rows": 2, "rows": 2,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.f2 < 2" "attached_condition": "t1.f2 < 2"
} }
......
...@@ -243,7 +243,7 @@ rows_examined sql_text ...@@ -243,7 +243,7 @@ rows_examined sql_text
4 UPDATE t1 SET a=a+sleep(.02) WHERE a>2 4 UPDATE t1 SET a=a+sleep(.02) WHERE a>2
8 UPDATE t1 SET a=a+sleep(.02) ORDER BY a DESC 8 UPDATE t1 SET a=a+sleep(.02) ORDER BY a DESC
1 UPDATE t2 set b=b+sleep(.02) limit 1 1 UPDATE t2 set b=b+sleep(.02) limit 1
10 UPDATE t1 SET a=a+sleep(.02) WHERE a in (SELECT b from t2) 6 UPDATE t1 SET a=a+sleep(.02) WHERE a in (SELECT b from t2)
6 DELETE FROM t1 WHERE a=a+sleep(.02) ORDER BY a LIMIT 2 6 DELETE FROM t1 WHERE a=a+sleep(.02) ORDER BY a LIMIT 2
disconnect con2; disconnect con2;
connection default; connection default;
......
...@@ -1270,6 +1270,7 @@ DROP TABLES t1, t2; ...@@ -1270,6 +1270,7 @@ DROP TABLES t1, t2;
# End of 10.3 tests # End of 10.3 tests
# #
# MDEV-30538: multi-table UPDATE/DELETE with possible exists-to-in # MDEV-30538: multi-table UPDATE/DELETE with possible exists-to-in
#
create table t1 (c1 int, c2 int, c3 int, index idx(c2)); create table t1 (c1 int, c2 int, c3 int, index idx(c2));
insert into t1 values insert into t1 values
(1,1,1),(3,2,2),(1,3,3), (1,1,1),(3,2,2),(1,3,3),
......
...@@ -218,16 +218,14 @@ INSERT INTO t2 VALUES (1), (2), (3); ...@@ -218,16 +218,14 @@ INSERT INTO t2 VALUES (1), (2), (3);
# #
EXPLAIN UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3); EXPLAIN UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Using where; FirstMatch
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 1 PRIMARY t1 ALL NULL NULL NULL NULL 3
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
FLUSH STATUS; FLUSH STATUS;
FLUSH TABLES; FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3); EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3);
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 3 33.33 Using where; FirstMatch
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where
# Status of EXPLAIN EXTENDED query # Status of EXPLAIN EXTENDED query
Variable_name Value Variable_name Value
Handler_read_key 4 Handler_read_key 4
...@@ -248,9 +246,9 @@ Handler_read_key 4 ...@@ -248,9 +246,9 @@ Handler_read_key 4
Handler_read_rnd_next 5 Handler_read_rnd_next 5
# Status of testing query execution: # Status of testing query execution:
Variable_name Value Variable_name Value
Handler_read_key 5 Handler_read_key 4
Handler_read_rnd 3 Handler_read_rnd 3
Handler_read_rnd_next 12 Handler_read_rnd_next 9
Handler_update 3 Handler_update 3
DROP TABLE t1, t2; DROP TABLE t1, t2;
...@@ -904,15 +902,13 @@ INSERT INTO t2 VALUES (1), (2), (3), (1000); ...@@ -904,15 +902,13 @@ INSERT INTO t2 VALUES (1), (2), (3), (1000);
EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2); EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 1 PRIMARY t1 ALL NULL NULL NULL NULL 3
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; FirstMatch(t1)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3
FLUSH STATUS; FLUSH STATUS;
FLUSH TABLES; FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2); EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2);
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 4 100.00 Using where; FirstMatch(t1)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00
# Status of EXPLAIN EXTENDED query # Status of EXPLAIN EXTENDED query
Variable_name Value Variable_name Value
Handler_read_key 4 Handler_read_key 4
...@@ -933,8 +929,8 @@ Handler_read_key 4 ...@@ -933,8 +929,8 @@ Handler_read_key 4
Handler_read_rnd_next 9 Handler_read_rnd_next 9
# Status of testing query execution: # Status of testing query execution:
Variable_name Value Variable_name Value
Handler_read_key 7 Handler_read_key 4
Handler_read_rnd_next 8 Handler_read_rnd_next 10
Handler_update 3 Handler_update 3
DROP TABLE t1, t2; DROP TABLE t1, t2;
...@@ -2828,14 +2824,14 @@ INSERT INTO t2 VALUES (1), (2), (3); ...@@ -2828,14 +2824,14 @@ INSERT INTO t2 VALUES (1), (2), (3);
EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x); EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2 FirstMatch(t1) 1 PRIMARY <derived3> eq_ref distinct_key distinct_key 5 test.t1.a 1
3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using filesort 3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using filesort
FLUSH STATUS; FLUSH STATUS;
FLUSH TABLES; FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x); EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x);
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) 1 PRIMARY <derived3> eq_ref distinct_key distinct_key 5 test.t1.a 1 100.00
3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort 3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort
# Status of EXPLAIN EXTENDED query # Status of EXPLAIN EXTENDED query
Variable_name Value Variable_name Value
......
...@@ -4495,7 +4495,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { ...@@ -4495,7 +4495,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"rowid_filters": [ "rowid_filters": [
{ {
"key": "a", "key": "a",
"build_cost": 0.174715752, "build_cost": 0.001129926,
"rows": 3 "rows": 3
} }
] ]
...@@ -4570,7 +4570,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { ...@@ -4570,7 +4570,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"rowid_filters": [ "rowid_filters": [
{ {
"key": "a", "key": "a",
"build_cost": 0.174715752, "build_cost": 0.001129926,
"rows": 3 "rows": 3
} }
] ]
......
...@@ -634,6 +634,18 @@ a b ...@@ -634,6 +634,18 @@ a b
22 11 22 11
2 12 2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
......
...@@ -387,6 +387,12 @@ insert into t2 values (1, 21),(2, 12),(3, 23); ...@@ -387,6 +387,12 @@ insert into t2 values (1, 21),(2, 12),(3, 23);
select * from t11; select * from t11;
select * from t12; select * from t12;
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
select * from t12;
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
-- error ER_SUBQUERY_NO_1_ROW -- error ER_SUBQUERY_NO_1_ROW
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
......
...@@ -638,6 +638,18 @@ a b ...@@ -638,6 +638,18 @@ a b
22 11 22 11
2 12 2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
......
...@@ -641,6 +641,18 @@ a b ...@@ -641,6 +641,18 @@ a b
22 11 22 11
2 12 2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
......
...@@ -637,6 +637,18 @@ a b ...@@ -637,6 +637,18 @@ a b
22 11 22 11
2 12 2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
......
...@@ -640,6 +640,18 @@ a b ...@@ -640,6 +640,18 @@ a b
22 11 22 11
2 12 2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
......
...@@ -637,6 +637,18 @@ a b ...@@ -637,6 +637,18 @@ a b
22 11 22 11
2 12 2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
......
...@@ -15,8 +15,9 @@ use dbt3_s001; ...@@ -15,8 +15,9 @@ use dbt3_s001;
--enable_query_log --enable_query_log
create index i_n_name on nation(n_name); create index i_n_name on nation(n_name);
analyze table nation; analyze table
nation, lineitem, customer, orders, part, supplier, partsupp, region
persistent for all;
--echo # Pullout --echo # Pullout
--echo # ======= --echo # =======
...@@ -209,117 +210,148 @@ select c_name, c_acctbal from customer where $c6; ...@@ -209,117 +210,148 @@ select c_name, c_acctbal from customer where $c6;
--echo # Materialization --echo # Materialization
--echo # =============== --echo # ===============
set optimizer_switch='firstmatch=off';
let $c7= let $c7=
c_nationkey in (select n_nationkey from nation where
n_name in ('JAPAN', 'INDONESIA', 'PERU', 'ARGENTINA'))
and
c_custkey in (select o_custkey from orders c_custkey in (select o_custkey from orders
where o_orderDATE between '1992-01-09' and '1992-03-08'); where o_orderDATE between "1992-01-09" and "1995-01-08");
eval eval
explain explain
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c7;
eval eval
explain format=json
select c_name, c_acctbal from customer where $c7;
eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c7;
eval eval
explain explain
update customer set c_acctbal = c_acctbal+5 where $c7; update customer set c_acctbal = c_acctbal+20 where $c7;
eval eval
explain format=json update customer set c_acctbal = c_acctbal+20 where $c7;
update customer set c_acctbal = c_acctbal+5 where $c7;
eval
update customer set c_acctbal = c_acctbal+5 where $c7;
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c7;
eval eval
update customer set c_acctbal = c_acctbal-5 where $c7; update customer set c_acctbal = c_acctbal-20 where $c7;
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c7;
set optimizer_switch='firstmatch=default';
let $c8= let $c8=
c_custkey in (select o_custkey from orders c_custkey in (select o_custkey from orders
where o_orderDATE between '1992-06-09' and '1993-01-08'); where o_orderDATE between '1992-01-09' and '1993-03-08');
eval eval
explain explain
select c_name, c_acctbal from customer where $c8; select c_name, c_acctbal from customer where $c8;
eval eval
explain format=json
select c_name, c_acctbal from customer where $c8;
eval
select c_name, c_acctbal from customer where $c8; select c_name, c_acctbal from customer where $c8;
eval eval
explain explain
update customer set c_acctbal = c_acctbal+1 where $c8; update customer set c_acctbal = c_acctbal+5 where $c8;
eval eval
update customer set c_acctbal = c_acctbal+1 where $c8; explain format=json
update customer set c_acctbal = c_acctbal+5 where $c8;
eval
update customer set c_acctbal = c_acctbal+5 where $c8;
eval eval
select c_name, c_acctbal from customer where $c8; select c_name, c_acctbal from customer where $c8;
eval eval
update customer set c_acctbal = c_acctbal-1 where $c8; update customer set c_acctbal = c_acctbal-5 where $c8;
eval eval
select c_name, c_acctbal from customer where $c8; select c_name, c_acctbal from customer where $c8;
let $c9=
c_custkey in (select o_custkey from orders
where o_orderDATE between '1992-06-09' and '1993-01-08');
eval
explain
select c_name, c_acctbal from customer where $c9;
eval
select c_name, c_acctbal from customer where $c9;
eval
explain
update customer set c_acctbal = c_acctbal+1 where $c9;
eval
update customer set c_acctbal = c_acctbal+1 where $c9;
eval
select c_name, c_acctbal from customer where $c9;
eval
update customer set c_acctbal = c_acctbal-1 where $c9;
eval
select c_name, c_acctbal from customer where $c9;
--echo # Materialization SJM --echo # Materialization SJM
--echo # =================== --echo # ===================
let $c9= let $c10=
c_custkey in (select o_custkey from orders c_custkey in (select o_custkey from orders
where o_orderDATE between '1992-01-09' and '1992-03-08' where o_orderDATE between '1992-01-09' and '1992-03-08'
group by o_custkey having count(o_custkey) > 1); group by o_custkey having count(o_custkey) > 1);
eval eval
explain explain
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
eval eval
explain format=json explain format=json
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
eval eval
explain explain
update customer set c_acctbal = c_acctbal-5 where $c9; update customer set c_acctbal = c_acctbal-5 where $c10;
eval eval
explain format=json explain format=json
update customer set c_acctbal = c_acctbal-5 where $c9; update customer set c_acctbal = c_acctbal-5 where $c10;
eval eval
update customer set c_acctbal = c_acctbal-5 where $c9; update customer set c_acctbal = c_acctbal-5 where $c10;
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
eval eval
update customer set c_acctbal = c_acctbal+5 where $c9; update customer set c_acctbal = c_acctbal+5 where $c10;
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
let $c10= let $c11=
c_custkey in (select o_custkey from orders c_custkey in (select o_custkey from orders
where o_orderDATE between '1992-01-09' and '1993-03-08' where o_orderDATE between '1992-01-09' and '1993-03-08'
group by o_custkey having count(o_custkey) > 5); group by o_custkey having count(o_custkey) > 5);
eval eval
explain explain
select c_name, c_acctbal from customer where $c10; select c_name, c_acctbal from customer where $c11;
eval eval
select c_name, c_acctbal from customer where $c10; select c_name, c_acctbal from customer where $c11;
eval eval
explain explain
update customer set c_acctbal = c_acctbal-1 where $c10; update customer set c_acctbal = c_acctbal-1 where $c11;
eval eval
update customer set c_acctbal = c_acctbal-1 where $c10; update customer set c_acctbal = c_acctbal-1 where $c11;
eval eval
select c_name, c_acctbal from customer where $c10; select c_name, c_acctbal from customer where $c11;
eval eval
update customer set c_acctbal = c_acctbal+1 where $c10; update customer set c_acctbal = c_acctbal+1 where $c11;
eval eval
select c_name, c_acctbal from customer where $c10; select c_name, c_acctbal from customer where $c11;
--echo # Pullout PS --echo # Pullout PS
...@@ -350,6 +382,8 @@ deallocate prepare stmt; ...@@ -350,6 +382,8 @@ deallocate prepare stmt;
--echo # FirstMatch PS --echo # FirstMatch PS
--echo # ============= --echo # =============
set optimizer_switch='materialization=off';
eval eval
prepare stmt from " prepare stmt from "
update customer set c_acctbal = c_acctbal+? where $c5; update customer set c_acctbal = c_acctbal+? where $c5;
...@@ -371,28 +405,29 @@ select c_name, c_acctbal from customer where $c5; ...@@ -371,28 +405,29 @@ select c_name, c_acctbal from customer where $c5;
deallocate prepare stmt; deallocate prepare stmt;
set optimizer_switch='materialization=default';
--echo # Materialization PS --echo # Materialization PS
--echo # ================== --echo # ==================
eval eval
prepare stmt from " prepare stmt from "
update customer set c_acctbal = c_acctbal+? where $c7; update customer set c_acctbal = c_acctbal+? where $c8;
"; ";
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
set @a1=7; set @a1=7;
execute stmt using @a1; execute stmt using @a1;
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
set @a2=3; set @a2=3;
execute stmt using @a2; execute stmt using @a2;
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
execute stmt using -(@a1+@a2); execute stmt using -(@a1+@a2);
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
deallocate prepare stmt; deallocate prepare stmt;
...@@ -402,22 +437,22 @@ deallocate prepare stmt; ...@@ -402,22 +437,22 @@ deallocate prepare stmt;
eval eval
prepare stmt from " prepare stmt from "
update customer set c_acctbal = c_acctbal+? where $c9; update customer set c_acctbal = c_acctbal+? where $c10;
"; ";
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
set @a1=-2; set @a1=-2;
execute stmt using @a1; execute stmt using @a1;
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
set @a2=-1; set @a2=-1;
execute stmt using @a2; execute stmt using @a2;
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
execute stmt using -(@a1+@a2); execute stmt using -(@a1+@a2);
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
deallocate prepare stmt; deallocate prepare stmt;
...@@ -447,6 +482,8 @@ drop procedure p; ...@@ -447,6 +482,8 @@ drop procedure p;
--echo # FirstMatch SP --echo # FirstMatch SP
--echo # ============= --echo # =============
set optimizer_switch='materialization=off';
eval eval
create procedure p(d int) create procedure p(d int)
update customer set c_acctbal = c_acctbal+d where $c5; update customer set c_acctbal = c_acctbal+d where $c5;
...@@ -465,25 +502,27 @@ select c_name, c_acctbal from customer where $c5; ...@@ -465,25 +502,27 @@ select c_name, c_acctbal from customer where $c5;
drop procedure p; drop procedure p;
set optimizer_switch='materialization=default';
--echo # Materialization SP --echo # Materialization SP
--echo # ================== --echo # ==================
eval eval
create procedure p(d int) create procedure p(d int)
update customer set c_acctbal = c_acctbal+d where $c7; update customer set c_acctbal = c_acctbal+d where $c8;
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
call p(3); call p(3);
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
call p(7); call p(7);
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
call p(-(3+7)); call p(-(3+7));
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
drop procedure p; drop procedure p;
...@@ -493,19 +532,19 @@ drop procedure p; ...@@ -493,19 +532,19 @@ drop procedure p;
eval eval
create procedure p(d int) create procedure p(d int)
update customer set c_acctbal = c_acctbal+d where $c9; update customer set c_acctbal = c_acctbal+d where $c10;
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
call p(-1); call p(-1);
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
call p(-2); call p(-2);
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
call p(1+2); call p(1+2);
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
drop procedure p; drop procedure p;
......
...@@ -316,7 +316,7 @@ rollback; ...@@ -316,7 +316,7 @@ rollback;
# #
explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using where 1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using index condition
1 PRIMARY a ref t1_c2 t1_c2 5 test.t1.c2 8 Using index; FirstMatch(t1) 1 PRIMARY a ref t1_c2 t1_c2 5 test.t1.c2 8 Using index; FirstMatch(t1)
start transaction; start transaction;
update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
......
...@@ -32592,7 +32592,8 @@ bool Sql_cmd_dml::execute_inner(THD *thd) ...@@ -32592,7 +32592,8 @@ bool Sql_cmd_dml::execute_inner(THD *thd)
if (unlikely(thd->is_error())) if (unlikely(thd->is_error()))
goto err; goto err;
join->exec(); if (join->exec())
goto err;
if (thd->lex->describe & DESCRIBE_EXTENDED) if (thd->lex->describe & DESCRIBE_EXTENDED)
{ {
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment