Hands-on Lab·MySQL
MySQL Table Sizes and Growth
information_schema reports table sizes, and TABLE_ROWS is an estimate that was wrong every time it was read here. Useful for capacity, useless for counting.
Monitoring and Operations Guide 42 of 45 Beginner
- OSUbuntu 26.04 LTS
- MySQL8.4.10-0ubuntu0.26.04.1
- Topologydb-a01 source, db-b01 and db-c01 replicas
- TimeAbout 12 min
InnoDB samples index pages to estimate row counts. The sample size is controlled by innodb_stats_persistent_sample_pages, and no setting makes the estimate exact.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| db-a01 | 192.168.0.81 | Ubuntu 26.04 LTS | Primary / Source / Replica Set Member 1 | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when planning capacity. This matters because information_schema reports sizes from statistics rather than from the disk - TABLE_ROWS is an estimate, and the two views answer different halves of the question.
- running
ANALYZE TABLEfirst, since without it the size columns are stale - measuring the schema out of
information_schema - comparing that against the disk it actually lives on
Before you start
- The
appdbdatabase with theeventstable.
-
Measure the schema, freshly analysed
-
Compare the schema against the disk it lives on