-
Roy Lyseng authored
returns too many rows Patch #2 - address Guilhem's comments - added optimizer trace changes supplied by Guilhem. mysql-test/r/subquery_sj_all_bka_nixbnl.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 EXPLAIN changes due to no longer checking that a keyuse->val->type() is Item::FIELD_ITEM within JOIN::update_equalities_for_sjm(). mysql-test/suite/opt_trace/include/general.inc Modified optimizer trace settings for preservation of existing behaviour. mysql-test/suite/opt_trace/r/bugs_no_prot_all.result mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result mysql-test/suite/opt_trace/r/general_no_prot_all.result mysql-test/suite/opt_trace/r/general_no_prot_none.result mysql-test/suite/opt_trace/r/general_ps_prot_all.result mysql-test/suite/opt_trace/r/general_ps_prot_none.result Changed optimizer trace results. sql/item_cmpfunc.cc Code simplifications and added comments. Check on whether an equality originates from a semi-join equality is slightly changed. sql/item_subselect.cc Replaced use of TABLE_LIST::materialized with JOIN_TAB::materialized. sql/opt_explain.cc Semijoin_mat_exec pointer is taken from JOIN_TAB, not TABLE_LIST. Use inner_table_index instead of old table_index. sql/opt_range.cc Reverted use of JOIN::plan_is_single_table(). sql/sql_class.h In class Semijoin_mat_exec, added field mat_table_index, and renamed table_index to inner_table_index. inner_table_index is also made an absolute index (it used to be relative to mat_table_index). Member field_count is deleted. subq_exprs is converted from being a List to pointer to List. sql/sql_executor.cc In end_sj_materialize(), Semijoin_mat_exec is taken from JOIN_TAB. Some comment changes. join_materialize_table() is renamed to join_materialize_derived(). join_materialize_semijoin() zeroes last->next_select and last->sj_mat_exec after use. inner_table_index is converted to an absolute index. sql/sql_executor.h join_materialize_table() is renamed to join_materialize_derived(). sql/sql_join_buffer.cc Comment added inside JOIN_CACHE::calc_record_fields(). sql/sql_optimizer.cc Logic of eliminate_item_equal() is rewritten according to suggestion from Guilhem. JOIN::update_keyuse() is incorporated into JOIN::update_equalities(), which is renamed to JOIN::update_equalities_for_sjm(). Semijoin_mat_exec pointer is taken from JOIN_TAB instead of TABLE_LIST. JOIN::allocate_sj_mat_exec() is incorporated into JOIN::get_best_combination(). Local struct KEY_FIELD is renamed to Key_field in association with introduction of constructor. create_keyuse_for_table() now uses add_key_part() when creating keyuse array. sql/sql_optimizer.h Removed member sjm_nests from class JOIN, it is calculated locally. update_equalities() is renamed to update_equalities_for_sjm(). Updated comments. sql/sql_select.cc In clear_sj_tmp_tables(), added back clearing of materialized flag for semi-joined materialized tables. JOIN::destroy() now deletes all Semijoin_mat_exec objects. JOIN::get_best_combination(): Logic slightly re-arranged, creates the list of Semijoin_mat_exec objects. In JOIN::setup_materialized_table(), take Semijoin_mat_exec from JOIN_TAB, increment name allocation by 1 byte for null termination, use TABLE_LIST::init_one_table() to initialize object, modify "fanout" calculation for materialized temporary table, use POSITION::set_prefix_costs() to set cost. JOIN_TAB::cleanup(), earlier valgrind compensation deleted. sql/sql_select.h Added Semijoin_mat_exec pointer to class JOIN_TAB. sql/sql_show.cc Cosmetic changes.
Roy Lyseng authoredreturns too many rows Patch #2 - address Guilhem's comments - added optimizer trace changes supplied by Guilhem. mysql-test/r/subquery_sj_all_bka_nixbnl.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 EXPLAIN changes due to no longer checking that a keyuse->val->type() is Item::FIELD_ITEM within JOIN::update_equalities_for_sjm(). mysql-test/suite/opt_trace/include/general.inc Modified optimizer trace settings for preservation of existing behaviour. mysql-test/suite/opt_trace/r/bugs_no_prot_all.result mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result mysql-test/suite/opt_trace/r/general_no_prot_all.result mysql-test/suite/opt_trace/r/general_no_prot_none.result mysql-test/suite/opt_trace/r/general_ps_prot_all.result mysql-test/suite/opt_trace/r/general_ps_prot_none.result Changed optimizer trace results. sql/item_cmpfunc.cc Code simplifications and added comments. Check on whether an equality originates from a semi-join equality is slightly changed. sql/item_subselect.cc Replaced use of TABLE_LIST::materialized with JOIN_TAB::materialized. sql/opt_explain.cc Semijoin_mat_exec pointer is taken from JOIN_TAB, not TABLE_LIST. Use inner_table_index instead of old table_index. sql/opt_range.cc Reverted use of JOIN::plan_is_single_table(). sql/sql_class.h In class Semijoin_mat_exec, added field mat_table_index, and renamed table_index to inner_table_index. inner_table_index is also made an absolute index (it used to be relative to mat_table_index). Member field_count is deleted. subq_exprs is converted from being a List to pointer to List. sql/sql_executor.cc In end_sj_materialize(), Semijoin_mat_exec is taken from JOIN_TAB. Some comment changes. join_materialize_table() is renamed to join_materialize_derived(). join_materialize_semijoin() zeroes last->next_select and last->sj_mat_exec after use. inner_table_index is converted to an absolute index. sql/sql_executor.h join_materialize_table() is renamed to join_materialize_derived(). sql/sql_join_buffer.cc Comment added inside JOIN_CACHE::calc_record_fields(). sql/sql_optimizer.cc Logic of eliminate_item_equal() is rewritten according to suggestion from Guilhem. JOIN::update_keyuse() is incorporated into JOIN::update_equalities(), which is renamed to JOIN::update_equalities_for_sjm(). Semijoin_mat_exec pointer is taken from JOIN_TAB instead of TABLE_LIST. JOIN::allocate_sj_mat_exec() is incorporated into JOIN::get_best_combination(). Local struct KEY_FIELD is renamed to Key_field in association with introduction of constructor. create_keyuse_for_table() now uses add_key_part() when creating keyuse array. sql/sql_optimizer.h Removed member sjm_nests from class JOIN, it is calculated locally. update_equalities() is renamed to update_equalities_for_sjm(). Updated comments. sql/sql_select.cc In clear_sj_tmp_tables(), added back clearing of materialized flag for semi-joined materialized tables. JOIN::destroy() now deletes all Semijoin_mat_exec objects. JOIN::get_best_combination(): Logic slightly re-arranged, creates the list of Semijoin_mat_exec objects. In JOIN::setup_materialized_table(), take Semijoin_mat_exec from JOIN_TAB, increment name allocation by 1 byte for null termination, use TABLE_LIST::init_one_table() to initialize object, modify "fanout" calculation for materialized temporary table, use POSITION::set_prefix_costs() to set cost. JOIN_TAB::cleanup(), earlier valgrind compensation deleted. sql/sql_select.h Added Semijoin_mat_exec pointer to class JOIN_TAB. sql/sql_show.cc Cosmetic changes.
Loading