diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2023-01-30 13:25:02 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2023-01-30 13:25:02 +0100 |
commit | db8019ef00060dbd469a3adffeae2dff6e0a0969 (patch) | |
tree | 1ebc0b90f36ffadb4cb40665419ba7a5e6b9f2e2 /sql/sql_select.cc | |
parent | 6173a4a15b3f14b78c11576ee81c317d6df6d371 (diff) | |
parent | c8f2e9a5c0ac5905f28b050b7df5a9ffd914b7e7 (diff) | |
download | mariadb-git-db8019ef00060dbd469a3adffeae2dff6e0a0969.tar.gz |
Merge branch '10.4' into 10.5
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 2bcd38bf502..42711270f60 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7657,6 +7657,7 @@ best_access_path(JOIN *join, rec= MATCHING_ROWS_IN_OTHER_TABLE; // Fix for small tables Json_writer_object trace_access_idx(thd); + double eq_ref_rows= 0.0, eq_ref_cost= 0.0; /* full text keys require special treatment */ @@ -7701,7 +7702,10 @@ best_access_path(JOIN *join, tmp= adjust_quick_cost(table->opt_range[key].cost, 1); else tmp= table->file->avg_io_cost(); - tmp*= prev_record_reads(join_positions, idx, found_ref); + eq_ref_rows= prev_record_reads(join_positions, idx, + found_ref); + tmp*= eq_ref_rows; + eq_ref_cost= tmp; records=1.0; } else @@ -8019,8 +8023,8 @@ best_access_path(JOIN *join, Set the effective number of rows from "tmp" here. */ - keyread_tmp= tmp/ 2; - rows= tmp; + keyread_tmp= COST_ADD(eq_ref_cost / 2, s->startup_cost); + rows= eq_ref_rows; } else rows= record_count * records; |