summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-12-09 20:13:35 +0300
committerSergei Petrunia <sergey@mariadb.com>2022-02-25 10:23:48 +0300
commitbd946a40593921fec431f73547252ffa116acbea (patch)
treeb51654c6e3ab50b6c8ba3c156c9fde8880e20852
parentf23f45413fd02c180182cd341b800e2b9fa169f4 (diff)
downloadmariadb-git-bb-10.8-spetrunia.tar.gz
Code cleanup: don't call subquery_types_allow_materialization() on preparebb-10.8-spetrunia
For subqueries that are processed as semi-joins.
-rw-r--r--mysql-test/main/opt_trace.result119
-rw-r--r--sql/opt_subselect.cc3
2 files changed, 56 insertions, 66 deletions
diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result
index 226ab266789..d3021a2b395 100644
--- a/mysql-test/main/opt_trace.result
+++ b/mysql-test/main/opt_trace.result
@@ -2826,15 +2826,6 @@ explain extended select * from t1 where a in (select pk from t10) {
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
- "to": "materialization",
- "sjm_scan_allowed": true,
- "possible": true
- }
- },
- {
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
"to": "semijoin",
"chosen": true
}
@@ -2859,6 +2850,15 @@ explain extended select * from t1 where a in (select pk from t10) {
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
+ "to": "materialization",
+ "sjm_scan_allowed": true,
+ "possible": true
+ }
+ },
+ {
+ "transformation": {
+ "select_id": 2,
+ "from": "IN (SELECT)",
"to": "semijoin",
"converted_to_semi_join": true
}
@@ -4400,15 +4400,6 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
- "to": "materialization",
- "sjm_scan_allowed": true,
- "possible": true
- }
- },
- {
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
"to": "semijoin",
"chosen": true
}
@@ -4433,6 +4424,15 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
+ "to": "materialization",
+ "sjm_scan_allowed": true,
+ "possible": true
+ }
+ },
+ {
+ "transformation": {
+ "select_id": 2,
+ "from": "IN (SELECT)",
"to": "semijoin",
"converted_to_semi_join": true
}
@@ -4851,15 +4851,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
- "to": "materialization",
- "sjm_scan_allowed": true,
- "possible": true
- }
- },
- {
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
"to": "semijoin",
"chosen": true
}
@@ -4878,15 +4869,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"transformation": {
"select_id": 3,
"from": "IN (SELECT)",
- "to": "materialization",
- "sjm_scan_allowed": true,
- "possible": true
- }
- },
- {
- "transformation": {
- "select_id": 3,
- "from": "IN (SELECT)",
"to": "semijoin",
"chosen": true
}
@@ -4911,6 +4893,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
+ "to": "materialization",
+ "sjm_scan_allowed": true,
+ "possible": true
+ }
+ },
+ {
+ "transformation": {
+ "select_id": 2,
+ "from": "IN (SELECT)",
"to": "semijoin",
"converted_to_semi_join": true
}
@@ -4919,6 +4910,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"transformation": {
"select_id": 3,
"from": "IN (SELECT)",
+ "to": "materialization",
+ "sjm_scan_allowed": true,
+ "possible": true
+ }
+ },
+ {
+ "transformation": {
+ "select_id": 3,
+ "from": "IN (SELECT)",
"to": "semijoin",
"converted_to_semi_join": true
}
@@ -6431,15 +6431,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
- "to": "materialization",
- "sjm_scan_allowed": true,
- "possible": true
- }
- },
- {
- "transformation": {
- "select_id": 2,
- "from": "IN (SELECT)",
"to": "semijoin",
"chosen": true
}
@@ -6458,15 +6449,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"transformation": {
"select_id": 3,
"from": "IN (SELECT)",
- "to": "materialization",
- "sjm_scan_allowed": true,
- "possible": true
- }
- },
- {
- "transformation": {
- "select_id": 3,
- "from": "IN (SELECT)",
"to": "semijoin",
"chosen": true
}
@@ -6491,6 +6473,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
+ "to": "materialization",
+ "sjm_scan_allowed": true,
+ "possible": true
+ }
+ },
+ {
+ "transformation": {
+ "select_id": 2,
+ "from": "IN (SELECT)",
"to": "semijoin",
"converted_to_semi_join": true
}
@@ -6499,6 +6490,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"transformation": {
"select_id": 3,
"from": "IN (SELECT)",
+ "to": "materialization",
+ "sjm_scan_allowed": true,
+ "possible": true
+ }
+ },
+ {
+ "transformation": {
+ "select_id": 3,
+ "from": "IN (SELECT)",
"to": "semijoin",
"converted_to_semi_join": true
}
@@ -8896,17 +8896,6 @@ json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
{
"select_id": 2,
"from": "IN (SELECT)",
- "to": "materialization",
- "sjm_scan_allowed": true,
- "possible": true
- }
- },
-
- {
- "transformation":
- {
- "select_id": 2,
- "from": "IN (SELECT)",
"to": "semijoin",
"chosen": true
}
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index a74ec6ae5fe..622ce340e8b 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -703,7 +703,7 @@ int check_and_do_in_subquery_rewrites(JOIN *join)
{
DBUG_PRINT("info", ("Subquery is semi-join conversion candidate"));
- (void)subquery_types_allow_materialization(thd, in_subs);
+ //(void)subquery_types_allow_materialization(thd, in_subs);
in_subs->is_flattenable_semijoin= TRUE;
@@ -1271,6 +1271,7 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
while ((in_subq= li++))
{
bool remove_item= TRUE;
+ subquery_types_allow_materialization(thd, in_subq);
/* Stop processing if we've reached a subquery that's attached to the ON clause */
if (in_subq->do_not_convert_to_sj)