summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r--sql/opt_subselect.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 3aa5a188a26..d06480391be 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -2738,10 +2738,12 @@ bool Duplicate_weedout_picker::check_qep(JOIN *join,
}
table_map dups_removed_fanout= 0;
+ double current_fanout= prefix_rec_count;
for (uint j= first_dupsweedout_table; j <= idx; j++)
{
POSITION *p= join->positions + j;
- dups_cost += p->read_time;
+ current_fanout *= p->records_read;
+ dups_cost += p->read_time + current_fanout / TIME_FOR_COMPARE;
if (p->table->emb_sj_nest)
{
sj_inner_fanout *= p->records_read;