diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2015-02-20 03:17:46 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2015-02-20 03:17:46 +0300 |
commit | 775528ada3c2cc3a2a7ebafadebbcf44530aab50 (patch) | |
tree | e3e8a3cced2d7689a15778e9fbdb4cbd98ccb01a /sql/opt_subselect.cc | |
parent | 0f8b194146b50afe442682c5a14a8a179e28f3b8 (diff) | |
download | mariadb-git-775528ada3c2cc3a2a7ebafadebbcf44530aab50.tar.gz |
MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
Enable subquery materialization for non-SELECT queries with a SELECT part
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r-- | sql/opt_subselect.cc | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 7d1f6dfbf9d..d5e3334d961 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -513,8 +513,6 @@ bool is_materialization_applicable(THD *thd, Item_in_subselect *in_subs, Subquery !contains {GROUP BY, ORDER BY [LIMIT], aggregate functions}) && subquery predicate is not under "NOT IN")) - (*) The subquery must be part of a SELECT or CREATE TABLE ... SELECT statement. - The current condition also excludes multi-table update statements. A note about prepared statements: we want the if-branch to be taken on PREPARE and each EXECUTE. The rewrites are only done once, but we need select_lex->sj_subselects list to be populated for every EXECUTE. @@ -523,9 +521,7 @@ bool is_materialization_applicable(THD *thd, Item_in_subselect *in_subs, if (optimizer_flag(thd, OPTIMIZER_SWITCH_MATERIALIZATION) && // 0 !child_select->is_part_of_union() && // 1 parent_unit->first_select()->leaf_tables.elements && // 2 - (thd->lex->sql_command == SQLCOM_SELECT || // * - thd->lex->sql_command == SQLCOM_CREATE_TABLE) && // * - child_select->outer_select()->leaf_tables.elements && // 2A + child_select->outer_select()->leaf_tables.elements && // 2A subquery_types_allow_materialization(in_subs) && (in_subs->is_top_level_item() || //3 optimizer_flag(thd, |