summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2019-05-16 13:49:47 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2019-05-16 14:15:59 +0530
commit70a5fb49a74e2dfd57fa79ebbc0fc780ce898841 (patch)
tree258c487b093d1f2f083957de02df4cafce8f1d11 /sql/opt_range.cc
parent6ab9d1627a16b79429036f0ef10e05639bbcf46b (diff)
downloadmariadb-git-70a5fb49a74e2dfd57fa79ebbc0fc780ce898841.tar.gz
Fixed the case when statistics were not getting read because
we had the statistics tables in the FROM list of the select. The statistics for tables are not read in such cases, so we need to check this case separately.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 71e8055394c..e8421ad052a 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -3050,7 +3050,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
if (thd->variables.optimizer_use_condition_selectivity > 2 &&
!bitmap_is_clear_all(used_fields) &&
- thd->variables.use_stat_tables > 0)
+ thd->variables.use_stat_tables > 0 && table->stats_is_read)
{
PARAM param;
MEM_ROOT alloc;