1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +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

@ -977,6 +977,7 @@ ANALYZE
"r_rows": 100,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100,
"using_index_for_group_by": true
@ -1281,6 +1282,7 @@ ANALYZE
"r_loops": 0,
"rows": 1,
"r_rows": null,
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": null,
"impossible_on_condition": true
@ -1293,6 +1295,7 @@ ANALYZE
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
@ -1348,6 +1351,7 @@ ANALYZE
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
},
@ -1364,6 +1368,7 @@ ANALYZE
"r_rows": 1,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100,
"attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))",
@ -1425,6 +1430,7 @@ ANALYZE
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100,
"attached_condition": "t1.a is not null"
@ -1442,6 +1448,7 @@ ANALYZE
"r_rows": 1,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100,
"using_index": true,
@ -1518,6 +1525,7 @@ ANALYZE
"r_rows": 10,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100,
"attached_condition": "t3.a is not null"
@ -1536,6 +1544,7 @@ ANALYZE
"r_rows": 10,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100,
"index_condition_bka": "t4.b + 1 <= t3.b + 1"