1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-31577: Make ANALYZE FORMAT=JSON print innodb stats

ANALYZE FORMAT=JSON output now includes table.r_engine_stats which
has the engine statistics. Only non-zero members are printed.

Internally: EXPLAIN data structures Explain_table_acccess and
Explain_update now have handler* handler_for_stats pointer.
It is used to read statistics from handler_for_stats->handler_stats.

The following applies only to 10.9+, backport doesn't use it:

Explain data structures exist after the tables are closed. We avoid
walking invalid pointers using this:
- SQL layer calls Explain_query::notify_tables_are_closed() before
  closing tables.
- After that call, printing of JSON output is disabled. Non-JSON output
  can be printed but we don't access handler_for_stats when doing that.
This commit is contained in:
Sergei Petrunia
2023-07-06 10:41:46 +03:00
parent a03ce7b99c
commit 6e484c3bd9
32 changed files with 459 additions and 8 deletions

View File

@ -38,6 +38,7 @@ ANALYZE
"r_rows": 10,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 30,
"attached_condition": "t1.a in (2,3,4)"
@ -60,6 +61,7 @@ ANALYZE
"r_rows": 10,
"r_filtered": 30,
"r_total_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"attached_condition": "t1.a in (2,3,4)"
}
}
@ -80,6 +82,7 @@ ANALYZE
"r_rows": 10,
"r_filtered": 0,
"r_total_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"attached_condition": "t1.a in (20,30,40)"
}
}