summaryrefslogtreecommitdiff
path: root/sql/sql_explain.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2023-02-12 15:19:58 +0200
committerSergei Petrunia <sergey@mariadb.com>2023-02-21 15:36:15 +0300
commit793caf3a27cf02bc3fc871558d79b490441103fe (patch)
treefd8874ca495a39cc21c13833428ca253a6bf4117 /sql/sql_explain.cc
parent3c1b7fb03e35c4685f797f9ca410e15ae20c62cd (diff)
downloadmariadb-git-793caf3a27cf02bc3fc871558d79b490441103fe.tar.gz
Added r_table_loops to "ANALYZE FORMAT=JSON statement"
Author: Sergei Petrunia <sergey@mariadb.com>
Diffstat (limited to 'sql/sql_explain.cc')
-rw-r--r--sql/sql_explain.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index 5cfe3082b35..e98728eb443 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -1922,7 +1922,15 @@ void Explain_table_access::print_explain_json(Explain_query *query,
/* r_loops (not present in tabular output) */
if (is_analyze)
{
- writer->add_member("r_loops").add_ll(tracker.get_loops());
+ ha_rows loops= tracker.get_loops();
+ writer->add_member("r_loops").add_ll(loops);
+
+ if (type == JT_EQ_REF) // max one row
+ {
+ ha_rows table_loops= op_tracker.get_loops();
+ if (table_loops != loops)
+ writer->add_member("r_table_loops").add_ll(table_loops);
+ }
}
/* `rows` */