diff options
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 62824c44f89..583839fd66d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -18803,6 +18803,14 @@ void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab, join->cur_sj_inner_tables= save_cur_sj_inner_tables; *reopt_cost= cost; + if (rec_count < *outer_rec_count) + { + /* + The tables inside the subquery produce smaller fanout than outer tables. + This can happen in edge cases. + */ + *outer_rec_count= rec_count; + } } |