summaryrefslogtreecommitdiff
path: root/sql/sql_statistics.h
diff options
context:
space:
mode:
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) {