summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2023-01-30 11:49:42 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2023-01-30 11:49:42 +0100
commitc8f2e9a5c0ac5905f28b050b7df5a9ffd914b7e7 (patch)
treeffb20267a7b29f86fee3d04641a4a640de7f6a01
parent9c6fcdb85ef0b82767a036764afafcc2483e906c (diff)
downloadmariadb-git-c8f2e9a5c0ac5905f28b050b7df5a9ffd914b7e7.tar.gz
Fix number of rows passing in case of EQ_REFmariadb-10.4.28
-rw-r--r--sql/sql_select.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 4ec7f5d746d..0f8ead46ffc 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -7557,6 +7557,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;
/*
full text keys require special treatment
*/
@@ -7595,7 +7596,8 @@ best_access_path(JOIN *join,
type= JT_EQ_REF;
trace_access_idx.add("access_type", join_type_str[type])
.add("index", keyinfo->name);
- tmp = prev_record_reads(join_positions, idx, found_ref);
+ eq_ref_rows= tmp = prev_record_reads(join_positions, idx,
+ found_ref);
records=1.0;
}
else
@@ -7918,8 +7920,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_rows / 2, s->startup_cost);
+ rows= eq_ref_rows;
}
else
rows= record_count * records;