Get the Size of Every MySQL Database and Table

Last updated: August 29, 2026.

MySQL reports table data and index allocation through INFORMATION_SCHEMA.TABLES. The following queries convert the byte counts to mebibytes (MiB) and list the largest results first.

Size of every database

SELECT
  table_schema AS database_name,
  ROUND(SUM(COALESCE(data_length, 0) + COALESCE(index_length, 0))
        / 1024 / 1024, 2) AS size_mib
FROM information_schema.tables
WHERE table_schema NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys')
GROUP BY table_schema
ORDER BY size_mib DESC;

Largest tables

SELECT
  table_schema AS database_name,
  table_name,
  engine,
  ROUND(COALESCE(data_length, 0) / 1024 / 1024, 2) AS data_mib,
  ROUND(COALESCE(index_length, 0) / 1024 / 1024, 2) AS index_mib,
  ROUND((COALESCE(data_length, 0) + COALESCE(index_length, 0))
        / 1024 / 1024, 2) AS total_mib
FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
  AND table_schema NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys')
ORDER BY total_mib DESC
LIMIT 50;

Interpret the results

These values describe storage allocated to table data and indexes, not the exact size of a logical backup. For InnoDB, the figures are estimates derived from allocated pages and may include space that is not currently occupied by rows. Shared tablespaces, binary logs, temporary files, and backups are outside these totals.

The column definitions and storage-engine notes are documented in MySQL’s INFORMATION_SCHEMA.TABLES reference.

Related MySQL administration guides

Use these focused checks when database growth is accompanied by connection, migration, encoding, time-zone, or table-health problems.

admin

admin

4 thoughts on “Get the Size of Every MySQL Database and Table

Leave a Reply

Your email address will not be published.