dataiotech Labs
Scripts Library/mysql/#40
Script #40
mysql
Monitoringread-onlyMin Version: 5.7

MySQL Memory Usage by Component

Shows the biggest memory consumers and total allocated memory. Used when investigating OOM kills and suspected memory leaks.

#memory#performance_schema#sys-schema
mysql · sql
SELECT event_name, current_count, current_alloc, high_alloc
FROM sys.memory_global_by_current_bytes
LIMIT 15;

SELECT * FROM sys.memory_global_total;
Operational Notes & Remediation Guidance

Innodb_buffer_pool_size typically accounts for 60-80% of total system memory on dedicated database hosts.

Production Safety & Execution Standards
  • This script is designed for read-only diagnostics; it does not alter schema or modify data directly.
  • Prior to executing on production systems under high load, verify the target database version (Min. Version: 5.7).
  • Exercise caution with mutating actions (e.g., terminating sessions or dropping indexes) referenced in the notes section.

Engineering Triad: Related Runbooks & Incident Response

Which production incidents and emergency drills execute this script as a diagnosis step?

Runbook Library (63)
Related Alerts & Metrics
M16MySQL InnoDB Buffer Pool Hit RatioMySQL