From f671a9dee73c863cf6645ee2a1ff1284f606b6b4 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 29 Sep 2020 19:02:05 +0300 Subject: [PATCH] Replace find_temporary_table() with is_temporary_table() DROP TABLE opens all temporary tables at start, but then uses find_temporary_table() to check if a table is temporary instead of is_temporary_table() which is much faster. This patch fixes this issue. --- sql/sql_parse.cc | 2 +- sql/sql_table.cc | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7511f77d9c3..c37b555ae52 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4930,7 +4930,7 @@ mysql_execute_command(THD *thd) { if (!lex->tmp_table() && (!thd->is_current_stmt_binlog_format_row() || - !thd->find_temporary_table(table))) + !is_temporary_table(table))) { WSREP_TO_ISOLATION_BEGIN(NULL, NULL, all_tables); break; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 03ac4678b44..2c22680e71a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2131,8 +2131,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists, { LEX_CSTRING db_name= table->db; LEX_CSTRING table_name= table->table_name; - if (table->open_type == OT_BASE_ONLY || - !thd->find_temporary_table(table)) + if (!is_temporary_table(table)) (void) delete_statistics_for_table(thd, &db_name, &table_name); } }