diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-06-09 11:53:46 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-06-09 11:53:46 +0300 |
commit | c89e3b70a740f486db2c60270892ba2893bb5610 (patch) | |
tree | 946650c0e5e1f84ebb6aa19234c665393a963abd /sql/sql_select.cc | |
parent | 5efadf8d8c6076bbee73e45afe050ab62c517f3c (diff) | |
parent | 98293130c34cfd39bf2e8c904923abe3942d23be (diff) | |
download | mariadb-git-c89e3b70a740f486db2c60270892ba2893bb5610.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c3b87a13fcd..f3d853ccc06 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8335,6 +8335,10 @@ choose_plan(JOIN *join, table_map join_tables) { choose_initial_table_order(join); } + /* + Note: constant tables are already in the join prefix. We don't + put them into the cur_sj_inner_tables, though. + */ join->cur_sj_inner_tables= 0; if (straight_join) @@ -8648,8 +8652,8 @@ optimize_straight_join(JOIN *join, table_map join_tables) read_time+= COST_ADD(read_time - filter_cmp_gain, COST_ADD(position->read_time, record_count / (double) TIME_FOR_COMPARE)); - advance_sj_state(join, join_tables, idx, &record_count, &read_time, - &loose_scan_pos); + optimize_semi_joins(join, join_tables, idx, &record_count, &read_time, + &loose_scan_pos); join_tables&= ~(s->table->map); double pushdown_cond_selectivity= 1.0; @@ -8826,6 +8830,12 @@ greedy_search(JOIN *join, /* This has been already checked by best_extension_by_limited_search */ DBUG_ASSERT(!is_interleave_error); + /* + Also, update the semi-join optimization state. Information about the + picked semi-join operation is in best_pos->...picker, but we need to + update the global state in the JOIN object, too. + */ + update_sj_state(join, best_table, idx, remaining_tables); /* find the position of 'best_table' in 'join->best_ref' */ best_idx= idx; @@ -9624,8 +9634,8 @@ best_extension_by_limited_search(JOIN *join, trace_one_table.add("rows_for_plan", current_record_count); trace_one_table.add("cost_for_plan", current_read_time); } - advance_sj_state(join, remaining_tables, idx, ¤t_record_count, - ¤t_read_time, &loose_scan_pos); + optimize_semi_joins(join, remaining_tables, idx, ¤t_record_count, + ¤t_read_time, &loose_scan_pos); /* Expand only partial plans with lower cost than the best QEP so far */ if (current_read_time >= join->best_read) |