mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Optimising UNION ALL (WL 1687)
This commit is contained in:
@@ -339,8 +339,8 @@ int st_select_lex_unit::exec()
|
|||||||
item->reset();
|
item->reset();
|
||||||
table->file->delete_all_rows();
|
table->file->delete_all_rows();
|
||||||
}
|
}
|
||||||
if (union_distinct) // for subselects
|
if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL))
|
||||||
table->file->extra(HA_EXTRA_CHANGE_KEY_TO_UNIQUE);
|
DBUG_RETURN(1); // For sub-selects
|
||||||
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
|
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
|
||||||
{
|
{
|
||||||
ha_rows records_at_start= 0;
|
ha_rows records_at_start= 0;
|
||||||
@@ -392,7 +392,11 @@ int st_select_lex_unit::exec()
|
|||||||
records_at_start= table->file->records;
|
records_at_start= table->file->records;
|
||||||
sl->join->exec();
|
sl->join->exec();
|
||||||
if (sl == union_distinct)
|
if (sl == union_distinct)
|
||||||
table->file->extra(HA_EXTRA_CHANGE_KEY_TO_DUP);
|
{
|
||||||
|
if (table->file->disable_indexes(HA_KEY_SWITCH_ALL))
|
||||||
|
DBUG_RETURN(1);
|
||||||
|
table->no_keyread=1;
|
||||||
|
}
|
||||||
res= sl->join->error;
|
res= sl->join->error;
|
||||||
offset_limit_cnt= sl->offset_limit;
|
offset_limit_cnt= sl->offset_limit;
|
||||||
if (!res && union_result->flush())
|
if (!res && union_result->flush())
|
||||||
|
Reference in New Issue
Block a user