summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2023-05-11 09:59:27 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2023-05-11 09:59:27 +0300
commit616ced88bd0a3878c6b7acdaa331de8adb955553 (patch)
treef22fdd85d44b69991f2e911aae5049eb308182b5 /sql
parenta089ebd0dd11547019bed8bb8495b57c73666b83 (diff)
parent2763f733ee21572ae7a6e317e2e558d0a4842223 (diff)
downloadmariadb-git-10.10.tar.gz
Merge 10.9 into 10.1010.10
Diffstat (limited to 'sql')
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/sql_select.cc35
2 files changed, 19 insertions, 18 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 40d8c791a06..457e0d668b1 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1373,13 +1373,13 @@ bool Item_func_sformat::fix_length_and_dec(THD *thd)
for (uint i=0 ; i < arg_count ; i++)
{
- char_length+= args[i]->max_char_length();
if (args[i]->result_type() == STRING_RESULT &&
Type_std_attributes::agg_item_set_converter(c, func_name_cstring(),
args+i, 1, flags, 1))
return TRUE;
}
+ char_length= MAX_BLOB_WIDTH;
fix_char_length_ulonglong(char_length);
return FALSE;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 5ef40d39999..60781c059bd 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8646,25 +8646,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);