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/sql_lex.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/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index b169b9e0b27..336fdfe5560 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -7459,6 +7459,23 @@ Item *st_select_lex::build_cond_for_grouping_fields(THD *thd, Item *cond, return 0; } +bool st_select_lex::select_items_in_group_by() +{ + if (!group_list.elements) + return false; + for (ORDER *order= group_list.first; order; order= order->next) + { + List_iterator_fast<Item> it(item_list); + Item *item; + while ((item= it++)) + { + if (item->eq(*order->item,false)) + return true; + } + } + return false; +} + int set_statement_var_if_exists(THD *thd, const char *var_name, size_t var_name_length, ulonglong value) |