diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2014-11-29 03:07:24 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2014-11-29 03:07:24 +0300 |
commit | e235bb864d2b8daae3dc7061249f59fb0127bdc5 (patch) | |
tree | e8b48285ac8e14a5e0c004ccdcba6d60d3bc71ca /sql/sql_explain.h | |
parent | 0b5d989c894a14ebcb786940fafd025e31523d8b (diff) | |
download | mariadb-git-e235bb864d2b8daae3dc7061249f59fb0127bdc5.tar.gz |
ANALYZE FORMAT=JSON: better output and tests
- Print r_loops
- Always print r_* members. Print NULL values if no scans took place
- Added testcases.
Diffstat (limited to 'sql/sql_explain.h')
-rw-r--r-- | sql/sql_explain.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/sql_explain.h b/sql/sql_explain.h index a6a0aff7716..5d6b28fcd3f 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -22,8 +22,13 @@ public: }; +/* + A class for collecting read statistics. + + The idea is that we run several scans. Each scans gets rows, and then filters + some of them out. We count scans, rows, and rows left after filtering. +*/ -/* Data structures for ANALYZE */ class Table_access_tracker { public: @@ -38,6 +43,7 @@ public: ha_rows r_rows_after_where; /* Rows after applying attached part of WHERE */ bool has_scans() { return (r_scans != 0); } + ha_rows get_loops() { return r_scans; } ha_rows get_avg_rows() { return r_scans ? (ha_rows)rint((double) r_rows / r_scans): 0; @@ -611,7 +617,9 @@ public: void print_explain_json(Explain_query *query, Json_writer *writer, bool is_analyze); - /* ANALYZE members*/ + /* ANALYZE members */ + + /* Tracker for reading the table */ Table_access_tracker tracker; Table_access_tracker jbuf_tracker; |