mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +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:
@ -338,9 +338,11 @@ bool THD::open_temporary_table(TABLE_LIST *tl)
|
||||
have invalid db or table name.
|
||||
Instead THD::open_tables() should be used.
|
||||
*/
|
||||
DBUG_ASSERT(!tl->derived && !tl->schema_table);
|
||||
DBUG_ASSERT(!tl->derived);
|
||||
DBUG_ASSERT(!tl->schema_table);
|
||||
DBUG_ASSERT(has_temporary_tables());
|
||||
|
||||
if (tl->open_type == OT_BASE_ONLY || !has_temporary_tables())
|
||||
if (tl->open_type == OT_BASE_ONLY)
|
||||
{
|
||||
DBUG_PRINT("info", ("skip_temporary is set or no temporary tables"));
|
||||
DBUG_RETURN(false);
|
||||
@ -452,10 +454,13 @@ bool THD::open_temporary_table(TABLE_LIST *tl)
|
||||
*/
|
||||
bool THD::open_temporary_tables(TABLE_LIST *tl)
|
||||
{
|
||||
TABLE_LIST *first_not_own;
|
||||
DBUG_ENTER("THD::open_temporary_tables");
|
||||
|
||||
TABLE_LIST *first_not_own= lex->first_not_own_table();
|
||||
if (!has_temporary_tables())
|
||||
DBUG_RETURN(0);
|
||||
|
||||
first_not_own= lex->first_not_own_table();
|
||||
for (TABLE_LIST *table= tl; table && table != first_not_own;
|
||||
table= table->next_global)
|
||||
{
|
||||
@ -868,7 +873,7 @@ void THD::restore_tmp_table_share(TMP_TABLE_SHARE *share)
|
||||
@return false Temporary tables exist
|
||||
true No temporary table exist
|
||||
*/
|
||||
inline bool THD::has_temporary_tables()
|
||||
bool THD::has_temporary_tables()
|
||||
{
|
||||
DBUG_ENTER("THD::has_temporary_tables");
|
||||
bool result= (rgi_slave
|
||||
|
Reference in New Issue
Block a user