Check table size in MariaDB by querying INFORMATION_SCHEMA.TABLES or running SHOW TABLE STATUS.
Run a SELECT against information_schema.TABLES
. It shows data, index, and total size in bytes, which you can convert to MB or GB on the fly.
table_schema
, table_name
, data_length
, index_length
, round((data_length+index_length)/1024/1024,2)
AS size_mb
.
Filter on table_schema
and table_name
. This avoids scanning unneeded metadata and speeds up the query on servers with many databases.
Remove the table_name
filter. Sort by the calculated column to see the largest tables first.
Use SHOW TABLE STATUS LIKE 'Orders'
for a quick, human-readable summary. It’s handy in interactive sessions but harder to script.
Indexes increase read performance but consume space. Monitoring index_length
helps you spot oversized or unused indexes early.
Schedule the query in a nightly job and store results in an audit table. Trending sizes over time catches growth spikes before disk alerts fire.
No. Reading INFORMATION_SCHEMA is non-blocking and safe in production.
Values are approximate; the engine updates them periodically. For byte-level accuracy, run ANALYZE TABLE first.
Yes. Each partition appears as its own row in INFORMATION_SCHEMA.PARTITIONS; aggregate their sizes for a total.