summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-08-31 06:53:45 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-08-31 06:53:45 +0300
commitdb4a27ab738c3ab43173368117583402f995c4f1 (patch)
tree01a367ede38cc8ede00038a904c96b76e570de5f /sql/sql_select.cc
parentd1ef02e9592b744d6c8dbca9231152f0a58d4384 (diff)
parent396da1a70548f80ecf781cf352b0d4a5740c54f6 (diff)
downloadmariadb-git-db4a27ab738c3ab43173368117583402f995c4f1.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 150e8008096..bd6d9852f40 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8788,6 +8788,7 @@ void JOIN::get_prefix_cost_and_fanout(uint n_tables,
record_count= COST_MULT(record_count, best_positions[i].records_read);
read_time= COST_ADD(read_time, best_positions[i].read_time);
}
+ /* TODO: Take into account condition selectivities here */
}
*read_time_arg= read_time;// + record_count / TIME_FOR_COMPARE;
*record_count_arg= record_count;
@@ -16678,10 +16679,20 @@ 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
+ double pushdown_cond_selectivity= 1.0;
+ table_map real_table_bit= rs->table->map;
+ if (join->thd->variables.optimizer_use_condition_selectivity > 1)
+ {
+ pushdown_cond_selectivity= table_cond_selectivity(join, i, rs,
+ reopt_remaining_tables &
+ ~real_table_bit);
+ }
+ (*outer_rec_count) *= pushdown_cond_selectivity;
if (!rs->emb_sj_nest)
*outer_rec_count= COST_MULT(*outer_rec_count, pos.records_read);
+
}
join->cur_sj_inner_tables= save_cur_sj_inner_tables;