diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-06-11 12:02:26 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-06-11 12:02:26 +0300 |
commit | 7a7d9904e12335ee8b1eea9671138b3c469a3829 (patch) | |
tree | 548286a67627074306e28634f9626a2cabfd2dd0 | |
parent | 96ee9ea02e69fb45f369815ace2187dd73398ac4 (diff) | |
download | mariadb-git-7a7d9904e12335ee8b1eea9671138b3c469a3829.tar.gz |
MDEV-18479: Avoid COST_MULT(records, 1)
-rw-r--r-- | sql/sql_select.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index a273aae5425..0d94ba2f293 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3856,11 +3856,8 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list, table/view. */ for (i= 0; i < join->table_count ; i++) - { - records= COST_MULT(records, - join->best_positions[i].records_read ? - join->best_positions[i].records_read : 1); - } + if (double rr= join->best_positions[i].records_read) + records= COST_MULT(records, rr); ha_rows rows= records > HA_ROWS_MAX ? HA_ROWS_MAX : (ha_rows) records; set_if_smaller(rows, unit->select_limit_cnt); join->select_lex->increase_derived_records(rows); |