summaryrefslogtreecommitdiff
path: root/sql/sql_explain.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2015-04-04 00:47:10 +0300
committerSergei Petrunia <psergey@askmonty.org>2015-04-04 00:47:10 +0300
commit47c344b00fa6878e5d1ce4235f8016a1ec995967 (patch)
tree2317196c8100ca658794b54c1fb5b1c8f0596a16 /sql/sql_explain.cc
parenta220905083c382bec096dd1435b6620d348bbfeb (diff)
downloadmariadb-git-47c344b00fa6878e5d1ce4235f8016a1ec995967.tar.gz
MDEV-7904: ANALYZE FORMAT=JSON doesn't print r_rows for union output
Print r_rows. There is no table tracking for reading from tmp table, yet.
Diffstat (limited to 'sql/sql_explain.cc')
-rw-r--r--sql/sql_explain.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index c1f1b0218b5..900017e2476 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -514,6 +514,23 @@ void Explain_union::print_explain_json(Explain_query *query,
make_union_table_name(table_name_buffer);
writer->add_member("table_name").add_str(table_name_buffer);
writer->add_member("access_type").add_str("ALL"); // not very useful
+
+ /* r_loops (not present in tabular output) */
+ if (is_analyze)
+ {
+ writer->add_member("r_loops").add_ll(fake_select_lex_tracker.get_loops());
+ }
+
+ /* `r_rows` */
+ if (is_analyze)
+ {
+ writer->add_member("r_rows");
+ if (fake_select_lex_tracker.has_scans())
+ writer->add_double(fake_select_lex_tracker.get_avg_rows());
+ else
+ writer->add_null();
+ }
+
writer->add_member("query_specifications").start_array();
for (int i= 0; i < (int) union_members.elements(); i++)