summaryrefslogtreecommitdiff
path: root/sql/sql_statistics.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-02-23 00:56:14 +0100
committerSergei Golubchik <serg@mariadb.org>2021-02-23 09:25:57 +0100
commite841957416e9287d1e9b2e32c952d6d0c1a2e2ed (patch)
tree7363161fe48edbecbd562f36280ce3980835f9c2 /sql/sql_statistics.h
parent34fcd726a6d5ee6e41b48b5946df801cb079afc1 (diff)
parent640f42311a72fa82bf7117c2791fc47ceb420361 (diff)
downloadmariadb-git-e841957416e9287d1e9b2e32c952d6d0c1a2e2ed.tar.gz
Merge branch '10.3' into 10.4
Diffstat (limited to 'sql/sql_statistics.h')
-rw-r--r--sql/sql_statistics.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h
index 20ecf06bfee..35b3aa33acc 100644
--- a/sql/sql_statistics.h
+++ b/sql/sql_statistics.h
@@ -239,6 +239,17 @@ public:
bool is_available() { return get_size() > 0 && get_values(); }
+ /*
+ This function checks that histograms should be usable only when
+ 1) the level of optimizer_use_condition_selectivity > 3
+ 2) histograms have been collected
+ */
+ bool is_usable(THD *thd)
+ {
+ return thd->variables.optimizer_use_condition_selectivity > 3 &&
+ is_available();
+ }
+
void set_value(uint i, double val)
{
switch (type) {