Commit c17468d4 authored by Varun Gupta's avatar Varun Gupta

MDEV-16191: Analyze format=json gives incorrect value for r_limit inside a dependent

subquery when ORDER BY is present

Currently for setting r_limit we divide with the number of iterations we invoke the dependent subquery.
This is not needed for the case of limit. For varying limits we produce the output that the limit varies with
execution.
Also there is a type for filtered , we forgot to multiply by 100 as it is represented as a percent.
parent 3627dd7f
......@@ -303,7 +303,7 @@ ANALYZE
"r_rows": 10,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 1,
"r_filtered": 100,
"attached_condition": "(t0.a is not null)"
}
}
......
......@@ -39,7 +39,7 @@ void Filesort_tracker::print_json_members(Json_writer *writer)
if (r_limit == 0)
writer->add_str(varied_str);
else
writer->add_ll((longlong) rint(r_limit/get_r_loops()));
writer->add_ll((longlong) rint(r_limit));
}
writer->add_member("r_used_priority_queue");
......
......@@ -1642,7 +1642,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
{
/* Get r_filtered value from filesort */
if (fs_tracker->get_r_loops())
writer->add_double(fs_tracker->get_r_filtered());
writer->add_double(fs_tracker->get_r_filtered()*100);
else
writer->add_null();
}
......
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