diff options
author | Igor Babaev <igor@askmonty.org> | 2018-01-30 21:12:11 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2018-01-30 21:12:11 -0800 |
commit | 7a9611aee2ca27124f0b845d8cefe211b84f3045 (patch) | |
tree | 48a2041bd8db8dc5fc79eb4ac588fe5653273b84 /sql/opt_split.cc | |
parent | a1e0e64a47f39ab3f05a24a19386f0d1e45e60e7 (diff) | |
download | mariadb-git-7a9611aee2ca27124f0b845d8cefe211b84f3045.tar.gz |
Fixed MDEV-14994 Assertion `join->best_read < double(1.79...15e+308L)' or
server crash in JOIN::fix_all_splittings_in_plan
Cost formulas must take into account the case when a splittable table
has now rows.
Diffstat (limited to 'sql/opt_split.cc')
-rw-r--r-- | sql/opt_split.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/opt_split.cc b/sql/opt_split.cc index efc5a5e5551..8fb8b787299 100644 --- a/sql/opt_split.cc +++ b/sql/opt_split.cc @@ -645,7 +645,8 @@ double spl_postjoin_oper_cost(THD *thd, double join_record_count, uint rec_len) cost+= get_tmp_table_lookup_cost(thd, join_record_count,rec_len) * join_record_count; // cost to perform post join operation used here cost+= get_tmp_table_lookup_cost(thd, join_record_count, rec_len) + - join_record_count * log2 (join_record_count) * + (join_record_count == 0 ? 0 : + join_record_count * log2 (join_record_count)) * SORT_INDEX_CMP_COST; // cost to perform sorting return cost; } @@ -948,7 +949,9 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, spl_plan->table= best_table; spl_plan->key= best_key; spl_plan->parts= best_key_parts; - spl_plan->split_sel= best_rec_per_key / spl_opt_info->unsplit_card; + spl_plan->split_sel= best_rec_per_key / + (spl_opt_info->unsplit_card ? + spl_opt_info->unsplit_card : 1); uint rec_len= table->s->rec_buff_length; |