1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Monty
2020-04-06 15:41:33 +03:00
parent f9f33b85be
commit 91ffdc8380
4 changed files with 21 additions and 13 deletions

View File

@ -3691,9 +3691,9 @@ open_and_process_table(THD *thd, TABLE_LIST *tables, uint *counter, uint flags,
The problem is that since those attributes are not set in merge
children, another round of PREPARE will not help.
*/
error= thd->open_temporary_table(tables);
if (!error && !tables->table)
if (!thd->has_temporary_tables() ||
(!(error= thd->open_temporary_table(tables)) &&
!tables->table))
error= open_table(thd, tables, ot_ctx);
thd->pop_internal_handler();
@ -3710,9 +3710,9 @@ open_and_process_table(THD *thd, TABLE_LIST *tables, uint *counter, uint flags,
Repair_mrg_table_error_handler repair_mrg_table_handler;
thd->push_internal_handler(&repair_mrg_table_handler);
error= thd->open_temporary_table(tables);
if (!error && !tables->table)
if (!thd->has_temporary_tables() ||
(!(error= thd->open_temporary_table(tables)) &&
!tables->table))
error= open_table(thd, tables, ot_ctx);
thd->pop_internal_handler();
@ -3727,7 +3727,8 @@ open_and_process_table(THD *thd, TABLE_LIST *tables, uint *counter, uint flags,
still might need to look for a temporary table if this table
list element corresponds to underlying table of a merge table.
*/
error= thd->open_temporary_table(tables);
if (thd->has_temporary_tables())
error= thd->open_temporary_table(tables);
}
if (!error && !tables->table)