[Commits] 6c94c1569c9: MDEV-20519: Query plan regression with optimizer_use_condition_selectivity=4
revision-id: 6c94c1569c9f3ff3078fbb892fed8c0ba0d6bf9c (mariadb-10.1.41-34-g6c94c1569c9) parent(s): 0e38cd37c7be46ac2b57344476d68a6dc59bc3a4 author: Varun Gupta committer: Varun Gupta timestamp: 2019-09-07 07:21:38 +0530 message: MDEV-20519: Query plan regression with optimizer_use_condition_selectivity=4 The issue here was that inside the function table_cond_selectivity we were trying to use the ranges estimate for a key for which no sargable condition was present. The fix for this issue is to make sure to first check if range access is possible on the key, if yes only the use its estimate. --- sql/sql_select.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5b96c15bff5..cc209c229a3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7623,7 +7623,7 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s, /* Check if we have a prefix of key=const that matches a quick select. */ - if (!is_hash_join_key_no(key)) + if (!is_hash_join_key_no(key) && table->quick_keys.is_set(key)) { table_map quick_key_map= (table_map(1) << table->quick_key_parts[key]) - 1; if (table->quick_rows[key] &&
participants (1)
-
Varun