diff options
author | Varun Gupta <varunraiko1803@gmail.com> | 2018-03-27 02:48:55 +0530 |
---|---|---|
committer | Varun Gupta <varunraiko1803@gmail.com> | 2018-03-27 02:48:55 +0530 |
commit | ba7b03001c12b5c895c8658ac1e68e0ad83f8428 (patch) | |
tree | 128844a2795d072c3a8ffd3ccf6b5cea52ac3390 /sql/table.cc | |
parent | 52ade8a54243df9354c38cb1af799e811cd05989 (diff) | |
download | mariadb-git-10.3-MDEV-9959.tar.gz |
MDEV-9959: A serious MariaDB server performance bug10.3-MDEV-9959
Step #2: If any field in the select list of the derived tables is present in the group by list also , then we are again guaranteed that ref access to the derived table would always produce one row per key.
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/table.cc b/sql/table.cc index d2938a29ea6..f6d4a4ddc63 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -7126,10 +7126,17 @@ bool TABLE::add_tmp_key(uint key, uint key_parts, This handles the case when we have a single select in the derived table */ st_select_lex* first= derived->first_select(); - if ((first && !first->is_part_of_union() && - first->options & SELECT_DISTINCT) || - derived->check_distinct_in_union()) + if (first) + { + if (!first->is_part_of_union() && first->options & SELECT_DISTINCT) keyinfo->rec_per_key[key_parts-1]=1; + else + { + if (derived->check_distinct_in_union() || + (first->select_items_in_group_by())) + keyinfo->rec_per_key[key_parts-1]=1; + } + } } keyinfo->read_stats= NULL; |