1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-7836: ANALYZE FORMAT=JSON should provide info about GROUP/ORDER BY

Fix EXPLAIN FORMAT=JSON to produce output that's not worse than
the tabular form.
This commit is contained in:
Sergei Petrunia
2015-04-12 06:07:58 +02:00
parent cc8da9b75a
commit 2bbf3b89f6
5 changed files with 103 additions and 48 deletions

View File

@ -818,9 +818,19 @@ void Explain_select::print_explain_json(Explain_query *query,
if (using_temporary)
{
started_objects= 1;
if (using_filesort)
{
started_objects++;
writer->add_member("filesort").start_object();
}
writer->add_member("temporary_table").start_object();
writer->add_member("function").add_str("buffer");
}
else
{
if (using_filesort)
first_table_sort= &ops_tracker.filesort_tracker[0];
}
}
Explain_basic_join::print_explain_json_interns(query, writer, is_analyze,
@ -1293,7 +1303,12 @@ void add_json_keyset(Json_writer *writer, const char *elem_name,
/*
@param fs_tracker Normally NULL. When not NULL, it means that the join tab
used filesort.
used filesort to pre-sort the data. Then, sorted data
was read and the rest of the join was executed.
@note
EXPLAIN command will check whether fs_tracker is present, but it can't use
any value from fs_tracker (these are only valid for ANALYZE).
*/
void Explain_table_access::print_explain_json(Explain_query *query,
@ -1330,7 +1345,8 @@ void Explain_table_access::print_explain_json(Explain_query *query,
}
}
writer->add_member("filesort").start_object();
fs_tracker->print_json(writer);
if (is_analyze)
fs_tracker->print_json(writer);
}
if (bka_type.is_using_jbuf())