diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-12-14 18:09:23 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-12-14 18:09:23 +0200 |
commit | 588bd85d360a317966a23a39fc12ea9783f891cf (patch) | |
tree | 3162b4be3bd8ab51023700307a7d7338b1266728 /sql/sql_select.cc | |
parent | b96cb3c21b011c90523a9392078cc46a2e6bd22e (diff) | |
parent | 9ecd76652664ec92836ce8c4a7a98ff5dbe7bf46 (diff) | |
download | mariadb-git-bb-10.6-MDEV-21452.tar.gz |
Merge 10.6bb-10.6-MDEV-21452
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index bf3d4fd9bb1..caaf6d2f3e3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7926,7 +7926,8 @@ best_access_path(JOIN *join, access is to use the same index IDX, with the same or more key parts. (note: it is not clear how this rule is/should be extended to index_merge quick selects). Also if we have a hash join we prefer that - over a table scan + over a table scan. This heuristic doesn't apply if the quick select + uses the group-by min-max optimization. (3) See above note about InnoDB. (4) NOT ("FORCE INDEX(...)" is used for table and there is 'ref' access path, but there is no quick select) @@ -7944,7 +7945,9 @@ best_access_path(JOIN *join, Json_writer_object trace_access_scan(thd); if ((records >= s->found_records || best > s->read_time) && // (1) !(best_key && best_key->key == MAX_KEY) && // (2) - !(s->quick && best_key && s->quick->index == best_key->key && // (2) + !(s->quick && + s->quick->get_type() != QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX && // (2) + best_key && s->quick->index == best_key->key && // (2) best_max_key_part >= s->table->opt_range[best_key->key].key_parts) &&// (2) !((s->table->file->ha_table_flags() & HA_TABLE_SCAN_ON_INDEX) && // (3) ! s->table->covering_keys.is_clear_all() && best_key && !s->quick) &&// (3) |