diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2023-05-11 09:00:27 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2023-05-11 09:00:27 +0300 |
commit | 1f1eaef0afddb1d7aeb44ad118cfc40a69d059d3 (patch) | |
tree | af31ad76f857a000e154d9ce3004ff4dab29e0eb /sql/sql_select.cc | |
parent | 7d44e2e7ffc8df4e6936aa56439c569e1dd92edd (diff) | |
parent | 7124911a2c08beeb9b6aebb92eb2b6bedfabe413 (diff) | |
download | mariadb-git-10.8.tar.gz |
Merge 10.6 into 10.810.8
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8bc0b0dff59..bf1732ade6b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8526,25 +8526,26 @@ best_access_path(JOIN *join, fanout= hash_join_fanout(join, s, remaining_tables, rnd_records, hj_start_key, &stats_found); join_sel= 1.0; // Don't do the "10% heuristic" + if (stats_found) + goto fanout_computed; } - if (!stats_found) - { - /* - No OPTIMIZER_SWITCH_HASH_JOIN_CARDINALITY or no field statistics - found. - - Take into account if there is non constant constraints used with - earlier tables in the where expression. - If yes, this will set fanout to rnd_records/4. - We estimate that there will be HASH_FANOUT (10%) - hash matches / row. - */ - if (found_constraint && !force_estimate) - rnd_records= use_found_constraint(rnd_records); - fanout= rnd_records; - join_sel= 0.1; - } + /* + No OPTIMIZER_SWITCH_HASH_JOIN_CARDINALITY or no field statistics + found. + + Take into account if there is non constant constraints used with + earlier tables in the where expression. + If yes, this will set fanout to rnd_records/4. + We estimate that there will be HASH_FANOUT (10%) + hash matches / row. + */ + if (found_constraint && !force_estimate) + rnd_records= use_found_constraint(rnd_records); + fanout= rnd_records; + join_sel= 0.1; + + fanout_computed: tmp= s->quick ? s->quick->read_time : s->scan_time(); double cmp_time= (s->records - rnd_records)/TIME_FOR_COMPARE; tmp= COST_ADD(tmp, cmp_time); |