diff options
author | Monty <monty@mariadb.org> | 2020-04-06 15:41:33 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2020-04-19 17:33:51 +0300 |
commit | 91ffdc8380ab48a2d57dc81472beb80af115318f (patch) | |
tree | 2bc33b598ebbcc464d9775d80a38473e6a040e72 /sql/sql_cte.cc | |
parent | f9f33b85be6b5006f0ecd0de7961c71d415a9d73 (diff) | |
download | mariadb-git-91ffdc8380ab48a2d57dc81472beb80af115318f.tar.gz |
Don't try to open temporary tables if there are no temporary tables.
This was done to increase performance when not using temporary tables
as checking if a table is a temporary table involves a lot of code.
Diffstat (limited to 'sql/sql_cte.cc')
-rw-r--r-- | sql/sql_cte.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc index 93344956468..1d3226fef34 100644 --- a/sql/sql_cte.cc +++ b/sql/sql_cte.cc @@ -834,6 +834,7 @@ st_select_lex_unit *With_element::clone_parsed_spec(THD *thd, st_select_lex_unit *res= NULL; Query_arena backup; Query_arena *arena= thd->activate_stmt_arena_if_needed(&backup); + bool has_tmp_tables; if (!(lex= (LEX*) new(thd->mem_root) st_lex_local)) { @@ -879,11 +880,12 @@ st_select_lex_unit *With_element::clone_parsed_spec(THD *thd, spec_tables= lex->query_tables; spec_tables_tail= 0; + has_tmp_tables= thd->has_temporary_tables(); for (TABLE_LIST *tbl= spec_tables; tbl; tbl= tbl->next_global) { - if (!tbl->derived && !tbl->schema_table && + if (has_tmp_tables && !tbl->derived && !tbl->schema_table && thd->open_temporary_table(tbl)) goto err; spec_tables_tail= tbl; |