Skip to content

Check table and index size in MySQL

Read table storage statistics to find which tables account for the most data and index space.

SELECT TABLE_NAME AS table_name,
TABLE_ROWS AS estimated_rows,
DATA_LENGTH AS data_bytes,
INDEX_LENGTH AS index_bytes,
DATA_LENGTH + INDEX_LENGTH AS total_bytes,
DATA_FREE AS free_bytes
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_TYPE = 'BASE TABLE'
ORDER BY DATA_LENGTH + INDEX_LENGTH DESC;

The query reports bytes for base tables in the current database. For InnoDB, interpret the columns as follows:

Column Meaning
estimated_rows An estimate, rather than an exact row count
data_bytes Space allocated to the clustered index, which stores table data
index_bytes Space allocated to secondary indexes together
total_bytes The sum of data and index space
free_bytes Allocated but unused space reported for the tablespace

Free space can belong to a shared tablespace. Do not sum it across tables as guaranteed recoverable disk space. Other storage engines give these statistics different meanings.

  1. Open Admin › Storage on the target connection.
  2. Compare the tables’ data, index, and total sizes.
  3. Run the SQL above in the query editor when you need byte counts.

Use storage and maintenance for the available maintenance actions. Storage totals alone do not establish that a table needs maintenance.

MySQL exposes table metadata according to your account’s permissions. If a table is missing, confirm access to that table before comparing totals.

No extension is needed. For an access error, use Admin data troubleshooting.

Use find unused indexes for usage evidence, or diagnose performance to investigate a broader storage problem. Return to the MySQL overview.