mirror of
https://github.com/MariaDB/server.git
synced 2025-12-13 20:03:16 +03:00
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.
8 lines
342 B
PHP
8 lines
342 B
PHP
# Remove non-deterministic parts of ANALYZE FORMAT=JSON output:
|
|
# - any timings
|
|
# - Buffer sizes (depend on pointer size)
|
|
# - r_engine_stats depends on buffer pool state and whether old record versions
|
|
# were purged.
|
|
|
|
--replace_regex /("(r_[a-z_]*_time_ms|r_buffer_size)": )[^, \n]*/\1"REPLACED"/ /("r_engine_stats":) {[^}]*}/\1 REPLACED/
|