summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/sql_select.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index e4ea70ba47e..3975f0aff62 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -7342,8 +7342,11 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
*/
for (; quick_key_map & 1 ; quick_key_map>>= 1)
{
- while (keyuse->keypart == keyparts)
+ while (keyuse->table == table && keyuse->key == key &&
+ keyuse->keypart == keyparts)
+ {
keyuse++;
+ }
keyparts++;
}
sel /= table->quick_rows[key] / table->stat_records();