Skip to content
  • Roy Lyseng's avatar
    694dfc93
    WL#5561 - Enable semi-join transformation with outer join queries · 694dfc93
    Roy Lyseng authored
    mysql-test/include/join_cache.inc
      Turned off semi-join to preserve plan for an existing test.
    
    mysql-test/include/subquery_sj.inc
      Added new tests for queries that combine outer join with semi-join.
      See HLS of WL#5561 for a basic description of the new tests.
      The tests are grouped according to the "subquery patterns" defined
      in the WL.
    
    mysql-test/r/derived.result
      Test result changes
    
    mysql-test/r/explain_json_all.result
      Test result changes
    
    mysql-test/r/join_cache_bka.result
    mysql-test/r/join_cache_bka_nixbnl.result
    mysql-test/r/join_cache_bkaunique.result
    mysql-test/r/join_cache_bnl.result
    mysql-test/r/join_cache_nojb.result
      Turned off semi-join to preserve plan for an existing test.
    
    mysql-test/r/join_outer.result
    mysql-test/r/join_outer_bka.result
    mysql-test/r/join_outer_bka_nixbnl.result
      Test result changes
    
    mysql-test/r/subquery_all.result
    mysql-test/r/subquery_all_bka.result
    mysql-test/r/subquery_all_bka_nixbnl.result
    mysql-test/r/subquery_mat.result
    mysql-test/r/subquery_mat_all.result
      Some queries containing inner joins and outer joins that previously
      where executed as "DEPENDENT SUBQUERY" are now transformed
      to semi-joins.
    
    mysql-test/r/subquery_sj_all.result
    mysql-test/r/subquery_sj_all_bka.result
    mysql-test/r/subquery_sj_all_bka_nixbnl.result
    mysql-test/r/subquery_sj_all_bkaunique.result
    mysql-test/r/subquery_sj_dupsweed.result
    mysql-test/r/subquery_sj_dupsweed_bka.result
    mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
    mysql-test/r/subquery_sj_dupsweed_bkaunique.result
    mysql-test/r/subquery_sj_firstmatch.result
    mysql-test/r/subquery_sj_firstmatch_bka.result
    mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
    mysql-test/r/subquery_sj_firstmatch_bkaunique.result
    mysql-test/r/subquery_sj_loosescan.result
    mysql-test/r/subquery_sj_loosescan_bka.result
    mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
    mysql-test/r/subquery_sj_loosescan_bkaunique.result
    mysql-test/r/subquery_sj_mat.result
    mysql-test/r/subquery_sj_mat_bka.result
    mysql-test/r/subquery_sj_mat_bka_nixbnl.result
    mysql-test/r/subquery_sj_mat_bkaunique.result
    mysql-test/r/subquery_sj_mat_nosj.result
    mysql-test/r/subquery_sj_none.result
    mysql-test/r/subquery_sj_none_bka.result
    mysql-test/r/subquery_sj_none_bka_nixbnl.result
    mysql-test/r/subquery_sj_none_bkaunique.result
      Contains new results for tests added in WL#5561.
      Some queries containing inner joins and outer joins that previously
      where executed as "DEPENDENT SUBQUERY" are now transformed
      to semi-joins.
      Some results are reordered because of the new plans.
    
    mysql-test/r/subselect_innodb.result
      Some plans changed because of semi-join transformation.
    
    mysql-test/r/type_time.result
      Turned off semi-join to preserve plan for an existing test.
    
    mysql-test/r/user_var.result
      Test case results for bug#14058892.
    
    mysql-test/r/view.result
      One result reordering because plan was changed.
    
    mysql-test/suite/opt_trace/r/general_no_prot_all.result
    mysql-test/suite/opt_trace/r/general_ps_prot_all.result
    mysql-test/suite/opt_trace/r/general_no_prot_all.result
    mysql-test/suite/opt_trace/r/general_ps_prot_all.result
      Changed optimizer trace because plans were changed.
    
    mysql-test/t/join_outer.test
      Test case for bug#13980954.
    
    mysql-test/t/type_time.test
      Turned off semi-join to preserve plan for an existing test.
    
    mysql-test/t/user_var.test
      Test case for bug#14058892.
    
    sql/item_func.cc
      Item_func::fix_fields() was called for a previously fixed item.
      In order to avoid having yet another test in the caller, the
      DBUG_ASSERT(fixed == 0) was removed and fix_fields() will instead
      exit early when the item is already fixed.
      See LLD section 2.1.
    
    sql/item_subselect.cc
      Removed setting of const_item_cache from fix_after_pullout().
      Changed name of materialized subquery table from "materialized subselect"
      to "materialized-subquery".
    
    sql/sql_class.h
      Added field copy_field_count to class Semijoin_mat_exec.
    
    sql/sql_executor.cc
      do_sj_dups_weedout(): Corrected bug in NULL handling when writing
      duplicate weedout row.
      See LLD section 2.7.
      evaluate_null_complemented_join_record(): Made sure that
      duplicate weedout table is properly reset also when we add a
      null complemented row.
      See LLD section 2.6.
    
    sql/sql_optimizer.cc
      record_semijoin_nests() was split out from simplify_joins(), because
      sometimes a semi-join nest was recorded twice.
      Simplifying the complex simplify_joins() (sic) was also reasonable.
      See LLD section 2.9.
      semijoin_types_allow_materialization(): Small interface change.
      optimize_semijoin_nests(): as a short-term measure, disallow
      materialization when there are dependencies to the outer tables.
      See LLD section 2.2.
      build_bitmap_for_nested_join(): Updated to use the new nj_xxx fields.
      Record tables belonging in semi-join nests in the embedding outer join
      nest (if any).
      See LLD section 2.5.
      convert_subquery_to_semijoin(): Removed disabling of semi-join
      transformation when there are outer joins in the outer query.
      See LLD chapter 1.
      convert_subquery_to_semijoin(): Made changes to on_expr to be
      reflected in the permanent data as well (prep_on_expr).
      See LLD section 2.4.
      make_outerjoin_info(): Updated to use the new nj_xxx fields.
      See LLD section 2.5.
    
    sql/sql_optimizer.h
      Added definition of function set_prefix_tables().
    
    sql/sql_planner.cc
      check_interleaving_with_nj(): Updated to ignore join nests without
      nj_map information, and use new nj_xxx fields.
      backout_nj_sj_state(): Updated to use new nj_xxx fields.
    
    sql/sql_select.cc
      setup_semijoin_dups_elimination(): Code that assures that duplicate
      weedout extends across all tables of an outer join operation.
      See LLD section 2.8.
      setup_join_buffering(): Eliminated use of join cache when there
      is an outer join operation and first match strategy is used.
    
    sql/sql_select.h
      Added fields prefix_tables_map and added_tables_map to class
      JOIN_TAB.
    
    sql/table.cc
      When resolving a view, call fix_fields() on the view's WHERE
      condition only once. This fix_fields() call enables some needed
      initial transformations to the condition, and is prerequisite to
      separate out the view check option. However for subsequent
      executions, the view condition is part of complete query condition,
      and will be resolved as part of this. There was a crash because of
      this, because fix_fields() did non-permanent transformations on
      subquery transformed to semi-join on second execution.
    
    sql/table.h
      Replaced fields used to analyze nested joins with new ones:
      nj_total, nj_counter, nj_map.
      See LLD section 2.5.
    694dfc93
    WL#5561 - Enable semi-join transformation with outer join queries
    Roy Lyseng authored
    mysql-test/include/join_cache.inc
      Turned off semi-join to preserve plan for an existing test.
    
    mysql-test/include/subquery_sj.inc
      Added new tests for queries that combine outer join with semi-join.
      See HLS of WL#5561 for a basic description of the new tests.
      The tests are grouped according to the "subquery patterns" defined
      in the WL.
    
    mysql-test/r/derived.result
      Test result changes
    
    mysql-test/r/explain_json_all.result
      Test result changes
    
    mysql-test/r/join_cache_bka.result
    mysql-test/r/join_cache_bka_nixbnl.result
    mysql-test/r/join_cache_bkaunique.result
    mysql-test/r/join_cache_bnl.result
    mysql-test/r/join_cache_nojb.result
      Turned off semi-join to preserve plan for an existing test.
    
    mysql-test/r/join_outer.result
    mysql-test/r/join_outer_bka.result
    mysql-test/r/join_outer_bka_nixbnl.result
      Test result changes
    
    mysql-test/r/subquery_all.result
    mysql-test/r/subquery_all_bka.result
    mysql-test/r/subquery_all_bka_nixbnl.result
    mysql-test/r/subquery_mat.result
    mysql-test/r/subquery_mat_all.result
      Some queries containing inner joins and outer joins that previously
      where executed as "DEPENDENT SUBQUERY" are now transformed
      to semi-joins.
    
    mysql-test/r/subquery_sj_all.result
    mysql-test/r/subquery_sj_all_bka.result
    mysql-test/r/subquery_sj_all_bka_nixbnl.result
    mysql-test/r/subquery_sj_all_bkaunique.result
    mysql-test/r/subquery_sj_dupsweed.result
    mysql-test/r/subquery_sj_dupsweed_bka.result
    mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
    mysql-test/r/subquery_sj_dupsweed_bkaunique.result
    mysql-test/r/subquery_sj_firstmatch.result
    mysql-test/r/subquery_sj_firstmatch_bka.result
    mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
    mysql-test/r/subquery_sj_firstmatch_bkaunique.result
    mysql-test/r/subquery_sj_loosescan.result
    mysql-test/r/subquery_sj_loosescan_bka.result
    mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
    mysql-test/r/subquery_sj_loosescan_bkaunique.result
    mysql-test/r/subquery_sj_mat.result
    mysql-test/r/subquery_sj_mat_bka.result
    mysql-test/r/subquery_sj_mat_bka_nixbnl.result
    mysql-test/r/subquery_sj_mat_bkaunique.result
    mysql-test/r/subquery_sj_mat_nosj.result
    mysql-test/r/subquery_sj_none.result
    mysql-test/r/subquery_sj_none_bka.result
    mysql-test/r/subquery_sj_none_bka_nixbnl.result
    mysql-test/r/subquery_sj_none_bkaunique.result
      Contains new results for tests added in WL#5561.
      Some queries containing inner joins and outer joins that previously
      where executed as "DEPENDENT SUBQUERY" are now transformed
      to semi-joins.
      Some results are reordered because of the new plans.
    
    mysql-test/r/subselect_innodb.result
      Some plans changed because of semi-join transformation.
    
    mysql-test/r/type_time.result
      Turned off semi-join to preserve plan for an existing test.
    
    mysql-test/r/user_var.result
      Test case results for bug#14058892.
    
    mysql-test/r/view.result
      One result reordering because plan was changed.
    
    mysql-test/suite/opt_trace/r/general_no_prot_all.result
    mysql-test/suite/opt_trace/r/general_ps_prot_all.result
    mysql-test/suite/opt_trace/r/general_no_prot_all.result
    mysql-test/suite/opt_trace/r/general_ps_prot_all.result
      Changed optimizer trace because plans were changed.
    
    mysql-test/t/join_outer.test
      Test case for bug#13980954.
    
    mysql-test/t/type_time.test
      Turned off semi-join to preserve plan for an existing test.
    
    mysql-test/t/user_var.test
      Test case for bug#14058892.
    
    sql/item_func.cc
      Item_func::fix_fields() was called for a previously fixed item.
      In order to avoid having yet another test in the caller, the
      DBUG_ASSERT(fixed == 0) was removed and fix_fields() will instead
      exit early when the item is already fixed.
      See LLD section 2.1.
    
    sql/item_subselect.cc
      Removed setting of const_item_cache from fix_after_pullout().
      Changed name of materialized subquery table from "materialized subselect"
      to "materialized-subquery".
    
    sql/sql_class.h
      Added field copy_field_count to class Semijoin_mat_exec.
    
    sql/sql_executor.cc
      do_sj_dups_weedout(): Corrected bug in NULL handling when writing
      duplicate weedout row.
      See LLD section 2.7.
      evaluate_null_complemented_join_record(): Made sure that
      duplicate weedout table is properly reset also when we add a
      null complemented row.
      See LLD section 2.6.
    
    sql/sql_optimizer.cc
      record_semijoin_nests() was split out from simplify_joins(), because
      sometimes a semi-join nest was recorded twice.
      Simplifying the complex simplify_joins() (sic) was also reasonable.
      See LLD section 2.9.
      semijoin_types_allow_materialization(): Small interface change.
      optimize_semijoin_nests(): as a short-term measure, disallow
      materialization when there are dependencies to the outer tables.
      See LLD section 2.2.
      build_bitmap_for_nested_join(): Updated to use the new nj_xxx fields.
      Record tables belonging in semi-join nests in the embedding outer join
      nest (if any).
      See LLD section 2.5.
      convert_subquery_to_semijoin(): Removed disabling of semi-join
      transformation when there are outer joins in the outer query.
      See LLD chapter 1.
      convert_subquery_to_semijoin(): Made changes to on_expr to be
      reflected in the permanent data as well (prep_on_expr).
      See LLD section 2.4.
      make_outerjoin_info(): Updated to use the new nj_xxx fields.
      See LLD section 2.5.
    
    sql/sql_optimizer.h
      Added definition of function set_prefix_tables().
    
    sql/sql_planner.cc
      check_interleaving_with_nj(): Updated to ignore join nests without
      nj_map information, and use new nj_xxx fields.
      backout_nj_sj_state(): Updated to use new nj_xxx fields.
    
    sql/sql_select.cc
      setup_semijoin_dups_elimination(): Code that assures that duplicate
      weedout extends across all tables of an outer join operation.
      See LLD section 2.8.
      setup_join_buffering(): Eliminated use of join cache when there
      is an outer join operation and first match strategy is used.
    
    sql/sql_select.h
      Added fields prefix_tables_map and added_tables_map to class
      JOIN_TAB.
    
    sql/table.cc
      When resolving a view, call fix_fields() on the view's WHERE
      condition only once. This fix_fields() call enables some needed
      initial transformations to the condition, and is prerequisite to
      separate out the view check option. However for subsequent
      executions, the view condition is part of complete query condition,
      and will be resolved as part of this. There was a crash because of
      this, because fix_fields() did non-permanent transformations on
      subquery transformed to semi-join on second execution.
    
    sql/table.h
      Replaced fields used to analyze nested joins with new ones:
      nj_total, nj_counter, nj_map.
      See LLD section 2.5.
Loading