Browse Source

Code cleanup: don't call subquery_types_allow_materialization() on prepare

For subqueries that are processed as semi-joins.
bb-10.8-spetrunia
Sergei Petrunia 4 years ago
committed by Sergei Petrunia
parent
commit
bd946a4059
  1. 119
      mysql-test/main/opt_trace.result
  2. 3
      sql/opt_subselect.cc

119
mysql-test/main/opt_trace.result

@ -2822,15 +2822,6 @@ explain extended select * from t1 where a in (select pk from t10) {
"join_preparation": {
"select_id": 2,
"steps": [
{
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 2,
@ -2855,6 +2846,15 @@ explain extended select * from t1 where a in (select pk from t10) {
"join_optimization": {
"select_id": 1,
"steps": [
{
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 2,
@ -4396,15 +4396,6 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"join_preparation": {
"select_id": 2,
"steps": [
{
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 2,
@ -4429,6 +4420,15 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"join_optimization": {
"select_id": 1,
"steps": [
{
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 2,
@ -4847,15 +4847,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"join_preparation": {
"select_id": 2,
"steps": [
{
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 2,
@ -4874,15 +4865,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"join_preparation": {
"select_id": 3,
"steps": [
{
"transformation": {
"select_id": 3,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 3,
@ -4907,6 +4889,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"join_optimization": {
"select_id": 1,
"steps": [
{
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 2,
@ -4915,6 +4906,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"converted_to_semi_join": true
}
},
{
"transformation": {
"select_id": 3,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 3,
@ -6427,15 +6427,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"join_preparation": {
"select_id": 2,
"steps": [
{
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 2,
@ -6454,15 +6445,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"join_preparation": {
"select_id": 3,
"steps": [
{
"transformation": {
"select_id": 3,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 3,
@ -6487,6 +6469,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"join_optimization": {
"select_id": 1,
"steps": [
{
"transformation": {
"select_id": 2,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 2,
@ -6495,6 +6486,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"converted_to_semi_join": true
}
},
{
"transformation": {
"select_id": 3,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation": {
"select_id": 3,
@ -8891,17 +8891,6 @@ json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
}
},
{
"transformation":
{
"select_id": 2,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation":
{

3
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)

Loading…
Cancel
Save