Database Administration — Tue Apr 07

← Home | ← database-admin

MySQL - DBA Toolkit - Table Size and Growth

Tue Apr 07 — Identify your largest tables, compare data versus index footprint, and spot fragmentation that can be reclaimed with a table rebuild.
#mysql #dba #monitoring #storage #tool-kit

Table Size: Know What Is Taking Up Your Disk

Disk does not fill up overnight. It fills up gradually, driven by a handful of tables that nobody is watching — logging tables, audit tables, event history tables that grow without bound until they become a problem.

Knowing the size of your tables by schema is basic DBA hygiene. The data-to-index ratio tells you whether your indexes have grown disproportionately. The reclaimable space tells you how much fragmentation has built up from deletes and updates — space InnoDB holds but the OS cannot see.

TableSizeandGrowth.sql
    Loading…
  

Reading the Results

Per-Table View

ColumnWhat to Check
table_rowsEstimated row count from information_schema — approximate, not exact
data_mbSize of actual row data
index_mbSpace used by all indexes on this table
total_mbCombined footprint — what the table is costing on disk
reclaimable_mbSpace held by InnoDB but not containing live data — freed by OPTIMIZE TABLE
index_to_data_pctIndex size as a percentage of data size — over 100% is worth investigating

Schema Rollup

Use the second query to quickly identify which schemas are growing fastest or consuming the most space. A schema with a small table count but large total_mb usually has a few problem tables worth drilling into.

What to Watch For

SignalWhat It Means
reclaimable_mb >> data_mbHeavy delete/update churn — OPTIMIZE TABLE will reclaim space
index_to_data_pct > 100%Indexes are larger than the data they cover — possibly too many or too wide
Large table_rows with small total_mbVery narrow rows — often fine, but watch for hidden large columns (TEXT/BLOB)
Unexpected large table in a schemaLogging or audit table growing without a retention policy
Schema with rapidly growing total_mbMay need archival strategy or partitioning before it becomes a disk incident

table_rows in information_schema is an estimate based on InnoDB statistics. For exact counts run SELECT COUNT(*) FROM table_name — but be careful on large tables.

Gareth Winterman