1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Adjusted test results after rebase against 11.0.1

This commit is contained in:
Igor Babaev
2023-03-09 21:48:58 -08:00
parent c912fd3b29
commit 9a3fd1df01
19 changed files with 2944 additions and 930 deletions

View File

@ -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
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;

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +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
@ -242,16 +244,18 @@ drop table t;
--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
explain format=json
select c_name, c_acctbal from customer where $c7;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c7;
@ -263,9 +267,6 @@ eval
explain explain
delete from customer where $c7; delete from customer where $c7;
eval eval
explain format=json
delete from customer where $c7;
eval
delete from customer where $c7; delete from customer where $c7;
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c7;
@ -276,14 +277,18 @@ eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c7;
drop table t; drop table t;
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
explain format=json
select c_name, c_acctbal from customer where $c8;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c8; select c_name, c_acctbal from customer where $c8;
@ -295,6 +300,9 @@ eval
explain explain
delete from customer where $c8; delete from customer where $c8;
eval eval
explain format=json
delete from customer where $c8;
eval
delete from customer where $c8; delete from customer where $c8;
eval eval
select c_name, c_acctbal from customer where $c8; select c_name, c_acctbal from customer where $c8;
@ -306,20 +314,13 @@ select c_name, c_acctbal from customer where $c8;
drop table t; drop table t;
--echo # Materialization SJM
--echo # ===================
let $c9= let $c9=
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-06-09' and '1993-01-08');
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 $c9;
eval
explain format=json
select c_name, c_acctbal from customer where $c9;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c9;
@ -331,9 +332,6 @@ eval
explain explain
delete from customer where $c9; delete from customer where $c9;
eval eval
explain format=json
delete from customer where $c9;
eval
delete from customer where $c9; delete from customer where $c9;
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c9;
@ -345,14 +343,20 @@ select c_name, c_acctbal from customer where $c9;
drop table t; drop table t;
--echo # Materialization SJM
--echo # ===================
let $c10= 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 '1993-03-08' where o_orderDATE between '1992-01-09' and '1992-03-08'
group by o_custkey having count(o_custkey) > 5); group by o_custkey having count(o_custkey) > 1);
eval eval
explain explain
select c_name, c_acctbal from customer where $c10; select c_name, c_acctbal from customer where $c10;
eval
explain format=json
select c_name, c_acctbal from customer where $c10;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c10; select c_name, c_acctbal from customer where $c10;
@ -364,6 +368,9 @@ eval
explain explain
delete from customer where $c10; delete from customer where $c10;
eval eval
explain format=json
delete from customer where $c10;
eval
delete from customer where $c10; delete from customer where $c10;
eval eval
select c_name, c_acctbal from customer where $c10; select c_name, c_acctbal from customer where $c10;
@ -375,6 +382,36 @@ select c_name, c_acctbal from customer where $c10;
drop table t; drop table t;
let $c11=
c_custkey in (select o_custkey from orders
where o_orderDATE between '1992-01-09' and '1993-03-08'
group by o_custkey having count(o_custkey) > 5);
eval
explain
select c_name, c_acctbal from customer where $c11;
--sorted_result
eval
select c_name, c_acctbal from customer where $c11;
eval
create table t as
select * from customer where $c11;
eval
explain
delete from customer where $c11;
eval
delete from customer where $c11;
eval
select c_name, c_acctbal from customer where $c11;
insert into customer select * from t;
--sorted_result
eval
select c_name, c_acctbal from customer where $c11;
drop table t;
--echo # Pullout PS --echo # Pullout PS
--echo # ========== --echo # ==========
@ -416,6 +453,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 "
delete from customer where $c5; delete from customer where $c5;
@ -450,42 +489,43 @@ drop table t,r;
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 "
delete from customer where $c7 and c_name like ?; delete from customer where $c8 and c_name like ?;
"; ";
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
set @a1='Customer#%1_'; set @a1='Customer#%1_';
eval eval
create table t as create table t as
select * from customer where $c7 and c_name like @a1; select * from customer where $c8 and c_name like @a1;
execute stmt using @a1; execute stmt using @a1;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
insert into customer select * from t; insert into customer select * from t;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
set @a2='Customer#%3_'; set @a2='Customer#%3_';
eval eval
create table r as create table r as
select * from customer where $c7 and c_name like @a2; select * from customer where $c8 and c_name like @a2;
execute stmt using @a2; execute stmt using @a2;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
insert into customer select * from r; insert into customer select * from r;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
drop table t,r; drop table t,r;
deallocate prepare stmt; deallocate prepare stmt;
@ -496,38 +536,38 @@ deallocate prepare stmt;
eval eval
prepare stmt from " prepare stmt from "
delete from customer where $c7 and c_acctbal between ? and ?; delete from customer where $c10 and c_acctbal between ? and ?;
"; ";
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
set @a1=3500; set @a1=3500;
set @a2=4000; set @a2=4000;
eval eval
create table t as create table t as
select * from customer where $c9 and c_acctbal between @a1 and @a2; select * from customer where $c10 and c_acctbal between @a1 and @a2;
execute stmt using @a1, @a2; execute stmt using @a1, @a2;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
insert into customer select * from t; insert into customer select * from t;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
set @a3=-1000; set @a3=-1000;
set @a4=3500; set @a4=3500;
eval eval
create table r as create table r as
select * from customer where $c9 and c_acctbal between @a3 and @a4; select * from customer where $c10 and c_acctbal between @a3 and @a4;
execute stmt using @a3, @a4; execute stmt using @a3, @a4;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
insert into customer select * from r; insert into customer select * from r;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
drop table t,r; drop table t,r;
deallocate prepare stmt; deallocate prepare stmt;
@ -573,6 +613,8 @@ drop procedure p;
--echo # FirstMatch SP --echo # FirstMatch SP
--echo # ============= --echo # =============
set optimizer_switch='materialization=off';
eval eval
create procedure p(a int) create procedure p(a int)
delete from customer where $c5 and c_acctbal > a; delete from customer where $c5 and c_acctbal > a;
@ -606,39 +648,41 @@ drop table t,r;
drop procedure p; drop procedure p;
set optimizer_switch='materialization=default';
--echo # Materialization SP --echo # Materialization SP
--echo # ================== --echo # ==================
eval eval
create procedure p() create procedure p()
delete from customer where $c7; delete from customer where $c8;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
eval eval
create table t as create table t as
select * from customer where $c7; select * from customer where $c8;
call p(); call p();
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
insert into customer select * from t; insert into customer select * from t;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
eval eval
create table r as create table r as
select * from customer where $c7; select * from customer where $c8;
call p(); call p();
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
insert into customer select * from r; insert into customer select * from r;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c7; select c_name, c_acctbal from customer where $c8;
drop table t,r; drop table t,r;
drop procedure p; drop procedure p;
@ -649,33 +693,33 @@ drop procedure p;
eval eval
create procedure p() create procedure p()
delete from customer where $c9; delete from customer where $c10;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
eval eval
create table t as create table t as
select * from customer where $c9; select * from customer where $c10;
call p(); call p();
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
insert into customer select * from t; insert into customer select * from t;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
eval eval
create table r as create table r as
select * from customer where $c9; select * from customer where $c10;
call p(); call p();
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
insert into customer select * from r; insert into customer select * from r;
--sorted_result --sorted_result
eval eval
select c_name, c_acctbal from customer where $c9; select c_name, c_acctbal from customer where $c10;
drop table t,r; drop table t,r;
drop procedure p; drop procedure p;
@ -687,64 +731,44 @@ drop procedure p;
--sorted_result --sorted_result
eval eval
select c_name from customer where $c7; select c_name from customer where $c8;
eval eval
create table t as create table t as
select * from customer where $c7; select * from customer where $c8;
eval eval
explain explain
delete from customer where $c7 returning c_name; delete from customer where $c8 returning c_name;
--sorted_result --sorted_result
eval eval
delete from customer where $c7 returning c_name; delete from customer where $c8 returning c_name;
--sorted_result --sorted_result
eval eval
select c_name from customer where $c7; select c_name from customer where $c8;
insert into customer select * from t; insert into customer select * from t;
--sorted_result --sorted_result
eval eval
select c_name from customer where $c7; select c_name from customer where $c8;
drop table t; drop table t;
--sorted_result --sorted_result
eval eval
select c_name from customer where $c9; select c_name from customer where $c10;
eval eval
create table t as create table t as
select * from customer where $c9; select * from customer where $c10;
eval eval
explain explain
delete from customer where $c9 returning c_name; delete from customer where $c10 returning c_name;
--sorted_result --sorted_result
eval eval
delete from customer where $c9 returning c_name; delete from customer where $c10 returning c_name;
--sorted_result --sorted_result
eval eval
select c_name from customer where $c9; select c_name from customer where $c10;
insert into customer select * from t; insert into customer select * from t;
--sorted_result --sorted_result
eval eval
select c_name from customer where $c9; select c_name from customer where $c10;
drop table t;
--echo # Check for DELETE ... RETURNING with SJ subquery in WHERE
--sorted_result
eval
select c_name from customer where $c7;
eval
create table t as
select * from customer where $c7;
eval
explain
delete from customer where $c7 returning c_name;
--sorted_result
eval
delete from customer where $c7 returning c_name;
--sorted_result
eval
select c_name from customer where $c7;
insert into customer select * from t;
drop table t; drop table t;
--echo # Check for DELETE ... ORDER BY ...LIMIT with SJ subquery in WHERE --echo # Check for DELETE ... ORDER BY ...LIMIT with SJ subquery in WHERE

View File

@ -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
"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"
} }

View File

@ -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;

View File

@ -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),

View File

@ -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
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);
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
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);
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

View File

@ -4471,7 +4471,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
} }
] ]
@ -4546,7 +4546,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
} }
] ]

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

File diff suppressed because it is too large Load Diff

View File

@ -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;
--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
where o_orderDATE between '1992-01-09' and '1993-03-08');
eval
explain
select c_name, c_acctbal from customer where $c8;
eval
explain format=json
select c_name, c_acctbal from customer where $c8;
eval
select c_name, c_acctbal from customer where $c8;
eval
explain
update customer set c_acctbal = c_acctbal+5 where $c8;
eval
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
select c_name, c_acctbal from customer where $c8;
eval
update customer set c_acctbal = c_acctbal-5 where $c8;
eval
select c_name, c_acctbal from customer where $c8;
let $c9=
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-06-09' and '1993-01-08');
eval eval
explain explain
select c_name, c_acctbal from customer where $c8; select c_name, c_acctbal from customer where $c9;
eval eval
select c_name, c_acctbal from customer where $c8; select c_name, c_acctbal from customer where $c9;
eval eval
explain explain
update customer set c_acctbal = c_acctbal+1 where $c8; update customer set c_acctbal = c_acctbal+1 where $c9;
eval eval
update customer set c_acctbal = c_acctbal+1 where $c8; update customer set c_acctbal = c_acctbal+1 where $c9;
eval eval
select c_name, c_acctbal from customer where $c8; select c_name, c_acctbal from customer where $c9;
eval eval
update customer set c_acctbal = c_acctbal-1 where $c8; update customer set c_acctbal = c_acctbal-1 where $c9;
eval eval
select c_name, c_acctbal from customer where $c8; 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;
--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;
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;
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;
--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;
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;
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;

View File

@ -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;

View File

@ -32596,7 +32596,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)
{ {