Commit 80374509 authored by Monty's avatar Monty Committed by Sergei Golubchik

Added range_index to 'range' optimizer_trace output

Other things:
- Renamed "rowid_filter_key" to "rowid_filter_index" to keep things
  consistent
parent 8d241abb
...@@ -703,7 +703,7 @@ void print_best_access_for_table(THD *thd, POSITION *pos) ...@@ -703,7 +703,7 @@ void print_best_access_for_table(THD *thd, POSITION *pos)
if (pos->range_rowid_filter_info) if (pos->range_rowid_filter_info)
{ {
uint key_no= pos->range_rowid_filter_info->get_key_no(); uint key_no= pos->range_rowid_filter_info->get_key_no();
obj.add("rowid_filter_key", obj.add("rowid_filter_index",
pos->table->table->key_info[key_no].name); pos->table->table->key_info[key_no].name);
} }
} }
......
...@@ -7992,7 +7992,7 @@ apply_filter(THD *thd, TABLE *table, ALL_READ_COST *cost, ...@@ -7992,7 +7992,7 @@ apply_filter(THD *thd, TABLE *table, ALL_READ_COST *cost,
if (unlikely(thd->trace_started())) if (unlikely(thd->trace_started()))
{ {
Json_writer_object trace_filter(thd, "filter"); Json_writer_object trace_filter(thd, "filter");
trace_filter.add("rowid_filter_key", trace_filter.add("rowid_filter_index",
table->key_info[get_key_no()].name). table->key_info[get_key_no()].name).
add("index_only_cost", file->cost(cost->index_cost)). add("index_only_cost", file->cost(cost->index_cost)).
add("filter_startup_cost", filter_startup_cost). add("filter_startup_cost", filter_startup_cost).
...@@ -9108,7 +9108,11 @@ best_access_path(JOIN *join, ...@@ -9108,7 +9108,11 @@ best_access_path(JOIN *join,
{ {
trace_access_scan. trace_access_scan.
add("access_type", add("access_type",
type == JT_ALL ? scan_type : join_type_str[type]). type == JT_ALL ? scan_type : join_type_str[type]);
if (type == JT_RANGE)
trace_access_scan.
add("range_index", table->key_info[s->quick->index].name);
trace_access_scan.
add("rows", org_records). add("rows", org_records).
add("rows_after_filter", records_after_filter). add("rows_after_filter", records_after_filter).
add("rows_out", best.records_out). add("rows_out", best.records_out).
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment