summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc21
1 files changed, 9 insertions, 12 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 8d202697ae8..9bd6aa4d5d3 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -239,9 +239,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);
@@ -7963,7 +7961,7 @@ best_access_path(JOIN *join,
/* quick_range couldn't use key! */
records= (double) s->records/rec;
trace_access_idx.add("used_range_estimates", false)
- .add("cause", "not available");
+ .add("reason", "not available");
}
}
else
@@ -8001,16 +7999,14 @@ best_access_path(JOIN *join,
}
else
{
+ trace_access_idx.add("used_range_estimates", false);
if (table->opt_range_keys.is_set(key))
{
- trace_access_idx.add("used_range_estimates",false)
- .add("cause",
- "not better than ref estimates");
+ trace_access_idx.add("reason", "not better than ref estimates");
}
else
{
- trace_access_idx.add("used_range_estimates", false)
- .add("cause", "not available");
+ trace_access_idx.add("reason", "not available");
}
}
}
@@ -8248,7 +8244,7 @@ best_access_path(JOIN *join,
trace_access_idx.add("chosen", false)
.add("cause", cause ? cause : "cost");
}
- cause= NULL;
+ cause= nullptr;
} /* for each key */
records= best_records;
}
@@ -8291,7 +8287,6 @@ best_access_path(JOIN *join,
(!(s->table->map & join->outer_join) ||
join->allowed_outer_join_with_cache)) // (2)
{
- Json_writer_object trace_access_hash(thd);
double join_sel= 0.1;
/* Estimate the cost of the hash join access to the table */
double rnd_records= matching_candidates_in_table(s, found_constraint,
@@ -8317,9 +8312,10 @@ best_access_path(JOIN *join,
best_uses_jbuf= TRUE;
best_filter= 0;
best_type= JT_HASH;
+ Json_writer_object trace_access_hash(thd);
trace_access_hash.add("type", "hash");
trace_access_hash.add("index", "hj-key");
- trace_access_hash.add("cost", rnd_records);
+ trace_access_hash.add("rnd_records", rnd_records);
trace_access_hash.add("cost", best);
trace_access_hash.add("chosen", true);
}
@@ -29167,6 +29163,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));