diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2019-08-23 00:57:40 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2019-08-23 00:59:50 +0300 |
commit | de2db8acf746eec785f40ff778251fd0aa3949ae (patch) | |
tree | 29674b9e3ff76fe4233f8734a08416120dba4cc1 /sql/sql_select.cc | |
parent | 235cf969d21ba3406a9325d952fda47c589e58d6 (diff) | |
download | mariadb-git-bb-10.4-mdev20109.tar.gz |
MDEV-20109: Optimizer ignores distinct key created for materialized...bb-10.4-mdev20109
Sj_materialization_picker::check_qep(): fix error in cost/fanout
calculations:
- for each join prefix, add #prefix_rows / TIME_FOR_COMPARE to the cost,
like best_extension_by_limited_search does
- Remove the fanout produced by the subquery tables.
optimize_wo_join_buffering() (used by LooseScan and FirstMatch)
- also add #prefix_rows / TIME_FOR_COMPARE to the cost of each prefix.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e79e96bf210..546f1c420d5 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -16703,7 +16703,8 @@ void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab, reopt_remaining_tables &= ~rs->table->map; rec_count= COST_MULT(rec_count, pos.records_read); cost= COST_ADD(cost, pos.read_time); - + cost= COST_ADD(cost, rec_count / (double) TIME_FOR_COMPARE); + //TODO: take into account join condition selectivity here if (!rs->emb_sj_nest) *outer_rec_count= COST_MULT(*outer_rec_count, pos.records_read); |