summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index b67661e1c8a..c5cd615ead2 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -3128,6 +3128,12 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
}
+ if (quick && (quick->get_type() == QUICK_SELECT_I::QS_TYPE_ROR_UNION ||
+ quick->get_type() == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE))
+ {
+ table->cond_selectivity*= (quick->records/table_records);
+ }
+
bitmap_union(used_fields, &handled_columns);
/* Check if we can improve selectivity estimates by using sampling */