[Commits] 27a34db58b5: MDEV-16191: Analyze format=json gives incorrect value for r_limit inside a dependent

revision-id: 27a34db58b569862bd17baf8ec5dde75e89ec64e (mariadb-10.1.23-563-g27a34db58b5) parent(s): 1d4e1d3263bf3b87b473c12d4876f368dc3450b6 author: Varun Gupta committer: Varun Gupta timestamp: 2018-06-06 22:09:52 +0530 message: 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. --- mysql-test/r/analyze_stmt_orderby.result | 2 +- sql/sql_analyze_stmt.cc | 2 +- sql/sql_explain.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/analyze_stmt_orderby.result b/mysql-test/r/analyze_stmt_orderby.result index be1f01a2a52..238baff50e1 100644 --- a/mysql-test/r/analyze_stmt_orderby.result +++ b/mysql-test/r/analyze_stmt_orderby.result @@ -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)" } } diff --git a/sql/sql_analyze_stmt.cc b/sql/sql_analyze_stmt.cc index 098e99e88fc..68299d024fd 100644 --- a/sql/sql_analyze_stmt.cc +++ b/sql/sql_analyze_stmt.cc @@ -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"); diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index ac6bee05001..82107f9b922 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -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(); }
participants (1)
-
varunraiko1803@gmail.com