1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

ORDER BY index traversal direction in the optimizer trace

This commit is contained in:
Sergei Golubchik
2022-01-06 18:12:37 +01:00
parent d7e7f48eb4
commit 9b6d2ad745
2 changed files with 4 additions and 3 deletions

View File

@@ -2176,6 +2176,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
{
"index": "a_a",
"can_resolve_order": true,
"direction": 1,
"updated_limit": 47,
"index_scan_time": 47,
"usable": false,
@@ -2184,6 +2185,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
{
"index": "a_c",
"can_resolve_order": true,
"direction": 1,
"updated_limit": 47,
"range_scan_time": 4.331020747,
"index_scan_time": 4.331020747,

View File

@@ -232,9 +232,7 @@ static bool test_if_cheaper_ordering(const JOIN_TAB *tab,
ha_rows *new_select_limit,
uint *new_used_key_parts= NULL,
uint *saved_best_key_parts= NULL);
static int test_if_order_by_key(JOIN *join,
ORDER *order, TABLE *table, uint idx,
uint *used_key_parts);
static int test_if_order_by_key(JOIN *, ORDER *, TABLE *, uint, uint *);
static bool test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,
ha_rows select_limit, bool no_changes,
const key_map *map);
@@ -28967,6 +28965,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
DBUG_ASSERT (ref_key != (int) nr);
possible_key.add("can_resolve_order", true);
possible_key.add("direction", direction);
bool is_covering= (table->covering_keys.is_set(nr) ||
(table->file->index_flags(nr, 0, 1) &
HA_CLUSTERED_INDEX));