revision-id: 7c400434aac9e968696e6d6ad1b990d0ef70045e (mariadb-10.5.4-435-g7c400434aac) parent(s): 49b87749513fd931eb874d4559b34ed6aeec8f05 author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2021-01-25 15:53:51 +0300 message: MDEV-24666, Step #1: JOIN_TAB::choose_best_splitting sets records=0 If we get the estimated #records to be less than 1.0, don't set JOIN_TAB::records=0. Round it up to 1, instead. --- sql/opt_split.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sql/opt_split.cc b/sql/opt_split.cc index 6cb4a12e51f..12715ffa886 100644 --- a/sql/opt_split.cc +++ b/sql/opt_split.cc @@ -1015,6 +1015,12 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, } else startup_cost= spl_opt_info->unsplit_cost; + + // JOIN_TAB::records is integer. Make sure we did not set it to 0 + // when converting from unsplit_card. + if (!records) + records= 1; + return spl_plan; }