summaryrefslogtreecommitdiff
path: root/sql/sql_analyze_stmt.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-02-28 11:46:13 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-02-28 15:15:51 +0530
commit0c35e80dc9ff24bcb8e710cb8cb16428c8c9986f (patch)
treee9ad708728c8f3b50fe75cb38a8f1a57c379e0da /sql/sql_analyze_stmt.cc
parent8db623038f7158529e804e9607362939bff37337 (diff)
downloadmariadb-git-0c35e80dc9ff24bcb8e710cb8cb16428c8c9986f.tar.gz
MDEV-21838: Add information about packed addon fields in ANALYZE FORMAT=JSON10.5-mdev21784-reg1-base
It is useful to know whether sorting uses addon fields[packed|unpacked] or ROWID. Provide this information in ANALYZE FORMAT=JSON output.
Diffstat (limited to 'sql/sql_analyze_stmt.cc')
-rw-r--r--sql/sql_analyze_stmt.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/sql_analyze_stmt.cc b/sql/sql_analyze_stmt.cc
index fdabcf1e494..2147d6d7ffc 100644
--- a/sql/sql_analyze_stmt.cc
+++ b/sql/sql_analyze_stmt.cc
@@ -26,6 +26,7 @@
void Filesort_tracker::print_json_members(Json_writer *writer)
{
const char *varied_str= "(varied across executions)";
+ String str;
if (!get_r_loops())
writer->add_member("r_loops").add_null();
@@ -78,6 +79,25 @@ void Filesort_tracker::print_json_members(Json_writer *writer)
else
writer->add_size(sort_buffer_size);
}
+
+ get_data_format(&str);
+ writer->add_member("r_sort_mode").add_str(str.c_ptr(), str.length());
+}
+
+void Filesort_tracker::get_data_format(String *str)
+{
+ str->append("sort_key");
+ str->append(",");
+
+ if (r_using_addons)
+ {
+ if (r_packed_addon_fields)
+ str->append("packed_addon_fields");
+ else
+ str->append("addon_fields");
+ }
+ else
+ str->append("rowid");
}
void attach_gap_time_tracker(THD *thd, Gap_time_tracker *gap_tracker,