Skip to content

Commit

Permalink
Added range_index to 'range' optimizer_trace output
Browse files Browse the repository at this point in the history
Other things:
- Renamed "rowid_filter_key" to "rowid_filter_index" to keep things
  consistent
  • Loading branch information
montywi authored and spetrunia committed Feb 2, 2023
1 parent 367c780 commit eb68023
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sql/opt_trace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ void print_best_access_for_table(THD *thd, POSITION *pos)
if (pos->range_rowid_filter_info)
{
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);
}
}
Expand Down
8 changes: 6 additions & 2 deletions sql/sql_select.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7992,7 +7992,7 @@ apply_filter(THD *thd, TABLE *table, ALL_READ_COST *cost,
if (unlikely(thd->trace_started()))
{
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).
add("index_only_cost", file->cost(cost->index_cost)).
add("filter_startup_cost", filter_startup_cost).
Expand Down Expand Up @@ -9155,7 +9155,11 @@ best_access_path(JOIN *join,
{
trace_access_scan.
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_after_filter", records_after_filter).
add("rows_out", best.records_out).
Expand Down

0 comments on commit eb68023

Please sign in to comment.