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

MDEV-32475: Skip sorting if we will read one row

test_if_skip_sort_order() should catch the join types JT_EQ_REF,
JT_CONST and JT_SYSTEM and skip sort order for these.

Such join types imply retrieving of a single row of data, and sorting
of a single row can always be skipped.
This commit is contained in:
Oleg Smirnov
2023-10-14 12:58:29 +07:00
parent fefea24222
commit 680f732fb8
3 changed files with 44 additions and 1 deletions

View File

@ -23613,6 +23613,14 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
/* Check that we are always called with first non-const table */
DBUG_ASSERT(tab == tab->join->join_tab + tab->join->const_tables);
/* Sorting a single row can always be skipped */
if (tab->type == JT_EQ_REF ||
tab->type == JT_CONST ||
tab->type == JT_SYSTEM)
{
DBUG_RETURN(1);
}
/*
Keys disabled by ALTER TABLE ... DISABLE KEYS should have already
been taken into account.