Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
2ae8dc24
Commit
2ae8dc24
authored
Mar 09, 2023
by
Igor Babaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjusted test results after rebase against 11.0.1
parent
12840543
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
3128 additions
and
1114 deletions
+3128
-1114
mysql-test/main/delete.result
mysql-test/main/delete.result
+2
-4
mysql-test/main/delete_single_to_multi.result
mysql-test/main/delete_single_to_multi.result
+1252
-239
mysql-test/main/delete_single_to_multi.test
mysql-test/main/delete_single_to_multi.test
+110
-86
mysql-test/main/derived_cond_pushdown.result
mysql-test/main/derived_cond_pushdown.result
+2
-13
mysql-test/main/log_state.result
mysql-test/main/log_state.result
+1
-1
mysql-test/main/multi_update.result
mysql-test/main/multi_update.result
+1
-0
mysql-test/main/myisam_explain_non_select_all.result
mysql-test/main/myisam_explain_non_select_all.result
+10
-14
mysql-test/main/opt_trace.result
mysql-test/main/opt_trace.result
+2
-2
mysql-test/main/subselect.result
mysql-test/main/subselect.result
+12
-0
mysql-test/main/subselect.test
mysql-test/main/subselect.test
+6
-0
mysql-test/main/subselect_no_exists_to_in.result
mysql-test/main/subselect_no_exists_to_in.result
+12
-0
mysql-test/main/subselect_no_mat.result
mysql-test/main/subselect_no_mat.result
+12
-0
mysql-test/main/subselect_no_opts.result
mysql-test/main/subselect_no_opts.result
+12
-0
mysql-test/main/subselect_no_scache.result
mysql-test/main/subselect_no_scache.result
+12
-0
mysql-test/main/subselect_no_semijoin.result
mysql-test/main/subselect_no_semijoin.result
+12
-0
mysql-test/main/update_single_to_multi.result
mysql-test/main/update_single_to_multi.result
+1574
-699
mysql-test/main/update_single_to_multi.test
mysql-test/main/update_single_to_multi.test
+93
-54
mysql-test/main/update_use_source.result
mysql-test/main/update_use_source.result
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+2
-1
No files found.
mysql-test/main/delete.result
View file @
2ae8dc24
...
...
@@ -583,8 +583,7 @@ explain delete from t1
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
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
2 MATERIALIZED a ALL NULL NULL NULL NULL 8
1 PRIMARY a ALL NULL NULL NULL NULL 8 Using where; FirstMatch(t1)
delete from t1
where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
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;
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 <subquery2> eq_ref distinct_key distinct_key 4 func 1
2 MATERIALIZED a ALL NULL NULL NULL NULL 8
1 PRIMARY a ALL NULL NULL NULL NULL 8 Using where; FirstMatch(t1)
delete from t1
where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3
order by c2;
...
...
mysql-test/main/delete_single_to_multi.result
View file @
2ae8dc24
This diff is collapsed.
Click to expand it.
mysql-test/main/delete_single_to_multi.test
View file @
2ae8dc24
This diff is collapsed.
Click to expand it.
mysql-test/main/derived_cond_pushdown.result
View file @
2ae8dc24
...
...
@@ -13134,20 +13134,7 @@ EXPLAIN
"materialized": {
"query_block": {
"select_id": 3,
<<<<<<< 2ad65c4dbcb291867725d50d1f53c8da8549afb3
"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": {
"sort_key": "t1.f2",
"temporary_table": {
...
...
@@ -13156,7 +13143,9 @@ EXPLAIN
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f2 < 2"
}
...
...
mysql-test/main/log_state.result
View file @
2ae8dc24
...
...
@@ -243,7 +243,7 @@ rows_examined sql_text
4 UPDATE t1 SET a=a+sleep(.02) WHERE a>2
8 UPDATE t1 SET a=a+sleep(.02) ORDER BY a DESC
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
disconnect con2;
connection default;
...
...
mysql-test/main/multi_update.result
View file @
2ae8dc24
...
...
@@ -1270,6 +1270,7 @@ DROP TABLES t1, t2;
# End of 10.3 tests
#
# MDEV-30538: multi-table UPDATE/DELETE with possible exists-to-in
#
create table t1 (c1 int, c2 int, c3 int, index idx(c2));
insert into t1 values
(1,1,1),(3,2,2),(1,3,3),
...
...
mysql-test/main/myisam_explain_non_select_all.result
View file @
2ae8dc24
...
...
@@ -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);
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
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
FLUSH STATUS;
FLUSH TABLES;
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
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
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
...
...
@@ -248,9 +246,9 @@ Handler_read_key 4
Handler_read_rnd_next 5
# Status of testing query execution:
Variable_name Value
Handler_read_key
5
Handler_read_key
4
Handler_read_rnd 3
Handler_read_rnd_next
12
Handler_read_rnd_next
9
Handler_update 3
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);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; FirstMatch(t1)
FLUSH STATUS;
FLUSH TABLES;
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
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
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 100.00 Using where; FirstMatch(t1)
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
...
...
@@ -933,8 +929,8 @@ Handler_read_key 4
Handler_read_rnd_next 9
# Status of testing query execution:
Variable_name Value
Handler_read_key
7
Handler_read_rnd_next
8
Handler_read_key
4
Handler_read_rnd_next
10
Handler_update 3
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);
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 <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
FLUSH STATUS;
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);
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 <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
# Status of EXPLAIN EXTENDED query
Variable_name Value
...
...
mysql-test/main/opt_trace.result
View file @
2ae8dc24
...
...
@@ -4495,7 +4495,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"rowid_filters": [
{
"key": "a",
"build_cost": 0.
174715752
,
"build_cost": 0.
001129926
,
"rows": 3
}
]
...
...
@@ -4570,7 +4570,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"rowid_filters": [
{
"key": "a",
"build_cost": 0.
174715752
,
"build_cost": 0.
001129926
,
"rows": 3
}
]
...
...
mysql-test/main/subselect.result
View file @
2ae8dc24
...
...
@@ -634,6 +634,18 @@ a b
22 11
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);
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);
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);
...
...
mysql-test/main/subselect.test
View file @
2ae8dc24
...
...
@@ -387,6 +387,12 @@ insert into t2 values (1, 21),(2, 12),(3, 23);
select
*
from
t11
;
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
);
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
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
);
...
...
mysql-test/main/subselect_no_exists_to_in.result
View file @
2ae8dc24
...
...
@@ -638,6 +638,18 @@ a b
22 11
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);
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);
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);
...
...
mysql-test/main/subselect_no_mat.result
View file @
2ae8dc24
...
...
@@ -641,6 +641,18 @@ a b
22 11
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);
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);
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);
...
...
mysql-test/main/subselect_no_opts.result
View file @
2ae8dc24
...
...
@@ -637,6 +637,18 @@ a b
22 11
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);
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);
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);
...
...
mysql-test/main/subselect_no_scache.result
View file @
2ae8dc24
...
...
@@ -640,6 +640,18 @@ a b
22 11
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);
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);
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);
...
...
mysql-test/main/subselect_no_semijoin.result
View file @
2ae8dc24
...
...
@@ -637,6 +637,18 @@ a b
22 11
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);
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);
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);
...
...
mysql-test/main/update_single_to_multi.result
View file @
2ae8dc24
This diff is collapsed.
Click to expand it.
mysql-test/main/update_single_to_multi.test
View file @
2ae8dc24
...
...
@@ -15,8 +15,9 @@ use dbt3_s001;
--
enable_query_log
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
# =======
...
...
@@ -209,117 +210,148 @@ select c_name, c_acctbal from customer where $c6;
--
echo
# Materialization
--
echo
# ===============
set
optimizer_switch
=
'firstmatch=off'
;
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
where
o_orderDATE
between
'1992-01-09'
and
'1992-03-08'
);
where
o_orderDATE
between
"1992-01-09"
and
"1995-01-08"
);
eval
explain
select
c_name
,
c_acctbal
from
customer
where
$c7
;
eval
explain
format
=
json
select
c_name
,
c_acctbal
from
customer
where
$c7
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c7
;
eval
explain
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c7
;
update
customer
set
c_acctbal
=
c_acctbal
+
20
where
$c7
;
eval
explain
format
=
json
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c7
;
eval
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c7
;
update
customer
set
c_acctbal
=
c_acctbal
+
20
where
$c7
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c7
;
eval
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c7
;
update
customer
set
c_acctbal
=
c_acctbal
-
20
where
$c7
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c7
;
set
optimizer_switch
=
'firstmatch=default'
;
let
$c8
=
c_custkey
in
(
select
o_custkey
from
orders
where
o_orderDATE
between
'1992-0
6-09'
and
'1993-01
-08'
);
where
o_orderDATE
between
'1992-0
1-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
+
1
where
$c8
;
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c8
;
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
select
c_name
,
c_acctbal
from
customer
where
$c8
;
eval
update
customer
set
c_acctbal
=
c_acctbal
-
1
where
$c8
;
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
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
# ===================
let
$c
9
=
let
$c
10
=
c_custkey
in
(
select
o_custkey
from
orders
where
o_orderDATE
between
'1992-01-09'
and
'1992-03-08'
group
by
o_custkey
having
count
(
o_custkey
)
>
1
);
eval
explain
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
eval
explain
format
=
json
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
eval
explain
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
9
;
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
10
;
eval
explain
format
=
json
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
9
;
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
10
;
eval
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
9
;
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
10
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
eval
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c
9
;
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c
10
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
let
$c1
0
=
let
$c1
1
=
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
$c1
0
;
select
c_name
,
c_acctbal
from
customer
where
$c1
1
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c1
0
;
select
c_name
,
c_acctbal
from
customer
where
$c1
1
;
eval
explain
update
customer
set
c_acctbal
=
c_acctbal
-
1
where
$c1
0
;
update
customer
set
c_acctbal
=
c_acctbal
-
1
where
$c1
1
;
eval
update
customer
set
c_acctbal
=
c_acctbal
-
1
where
$c1
0
;
update
customer
set
c_acctbal
=
c_acctbal
-
1
where
$c1
1
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c1
0
;
select
c_name
,
c_acctbal
from
customer
where
$c1
1
;
eval
update
customer
set
c_acctbal
=
c_acctbal
+
1
where
$c1
0
;
update
customer
set
c_acctbal
=
c_acctbal
+
1
where
$c1
1
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c1
0
;
select
c_name
,
c_acctbal
from
customer
where
$c1
1
;
--
echo
# Pullout PS
...
...
@@ -350,6 +382,8 @@ deallocate prepare stmt;
--
echo
# FirstMatch PS
--
echo
# =============
set
optimizer_switch
=
'materialization=off'
;
eval
prepare
stmt
from
"
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
;
set
optimizer_switch
=
'materialization=default'
;
--
echo
# Materialization PS
--
echo
# ==================
eval
prepare
stmt
from
"
update customer set c_acctbal = c_acctbal+? where
$c
7
;
update customer set c_acctbal = c_acctbal+? where
$c
8
;
"
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
set
@
a1
=
7
;
execute
stmt
using
@
a1
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
set
@
a2
=
3
;
execute
stmt
using
@
a2
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
execute
stmt
using
-
(
@
a1
+@
a2
);
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
deallocate
prepare
stmt
;
...
...
@@ -402,22 +437,22 @@ deallocate prepare stmt;
eval
prepare
stmt
from
"
update customer set c_acctbal = c_acctbal+? where
$c
9
;
update customer set c_acctbal = c_acctbal+? where
$c
10
;
"
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
set
@
a1
=-
2
;
execute
stmt
using
@
a1
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
set
@
a2
=-
1
;
execute
stmt
using
@
a2
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
execute
stmt
using
-
(
@
a1
+@
a2
);
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
deallocate
prepare
stmt
;
...
...
@@ -447,6 +482,8 @@ drop procedure p;
--
echo
# FirstMatch SP
--
echo
# =============
set
optimizer_switch
=
'materialization=off'
;
eval
create
procedure
p
(
d
int
)
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
;
set
optimizer_switch
=
'materialization=default'
;
--
echo
# Materialization SP
--
echo
# ==================
eval
create
procedure
p
(
d
int
)
update
customer
set
c_acctbal
=
c_acctbal
+
d
where
$c
7
;
update
customer
set
c_acctbal
=
c_acctbal
+
d
where
$c
8
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
call
p
(
3
);
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
call
p
(
7
);
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
call
p
(
-
(
3
+
7
));
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
drop
procedure
p
;
...
...
@@ -493,19 +532,19 @@ drop procedure p;
eval
create
procedure
p
(
d
int
)
update
customer
set
c_acctbal
=
c_acctbal
+
d
where
$c
9
;
update
customer
set
c_acctbal
=
c_acctbal
+
d
where
$c
10
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
call
p
(
-
1
);
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
call
p
(
-
2
);
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
call
p
(
1
+
2
);
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
drop
procedure
p
;
...
...
mysql-test/main/update_use_source.result
View file @
2ae8dc24
...
...
@@ -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;
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)
start transaction;
update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
...
...
sql/sql_select.cc
View file @
2ae8dc24
...
...
@@ -32592,7 +32592,8 @@ bool Sql_cmd_dml::execute_inner(THD *thd)
if (unlikely(thd->is_error()))
goto err;
join->exec();
if (join->exec())
goto err;
if (thd->lex->describe & DESCRIBE_EXTENDED)
{
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment