Table Size Calculator

Calculate the on-disk size of a database table from row count and column definitions. Accounts for row overhead and alignment padding.

Row overhead and index sizes vary by engine
bytes
Page fill percentage
%
Physical Row Size
173 bytes
Data: 150 B + Overhead: 23 B
Raw Data Size
824.9 MB
Rows × physical row size before fill factor
Data + Slack
1.15 GB
With 70% fill factor — accounts for page fragmentation
Index Size
257.5 MB
3 index(es) × ~12 B/key × 1.5× engine multiplier
Total Table Size
1.40 GB
Data + slack + all indexes
With Replicas
4.21 GB
Primary + 2 replica(s) = 3 copies
Size Composition
■ Data 82%■ Indexes 18%

Growth Projections (25% annual)

YearProjected SizeWith ReplicasGrowth
Now1.40 GB4.21 GB
+1y1.75 GB5.26 GB+25%
+2y2.19 GB6.57 GB+56%
+3y2.74 GB8.22 GB+95%
+5y4.28 GB12.84 GB+205%

Engine Comparison (same data)

EngineRow OverheadIndex FactorEst. Total
MySQL (InnoDB)23 B1.5×1.40 GB
PostgreSQL27 B1.4×1.41 GB
SQL Server14 B1.3×1.31 GB
SQLite4 B1.2×1.23 GB
Planning notes, formulas, and examples

About the Table Size Calculator

Knowing the on-disk size of a database table is essential for capacity planning, migration sizing, and query optimization. The actual row width includes not just the column data, but also row headers (23 bytes in PostgreSQL, 13 bytes in MySQL InnoDB), null bitmaps, alignment padding, and page overhead. A table that looks like 100 bytes per row in the schema may actually occupy 140–160 bytes on disk.

This calculator lets you enter the row count and total column sizes, apply per-row overhead, and compute the total table size. It accounts for the row header and general padding that vary by database engine.

When This Page Helps

Schema definitions show logical column sizes, not physical storage sizes. This calculator adds the per-row overhead that database engines impose, giving you accurate on-disk size estimates for capacity planning and migration scheduling.

How to Use the Inputs

  1. Enter the total number of rows in the table.
  2. Enter the sum of all column sizes in bytes per row.
  3. Enter the per-row overhead (23 bytes for PostgreSQL, 13 for MySQL InnoDB).
  4. Review the total table size on disk.
  5. Compare with actual table size using database system views.
Formula used
row_physical_size = column_sizes_total + row_overhead; table_size = row_count × row_physical_size

Example Calculation

Result: 864.5 MB

Each row occupies 150 bytes of column data + 23 bytes of PostgreSQL tuple header = 173 bytes. For 5 million rows: 5,000,000 × 173 = 865,000,000 bytes ≈ 824.9 MB plus ~5% page overhead brings the total to approximately 866 MB.

Tips & Best Practices

  • Use pg_total_relation_size() in PostgreSQL to verify estimates against actual on-disk size.
  • Variable-length columns (VARCHAR, TEXT) use actual data length, not maximum declared length.
  • NULL columns save space—a NULL value uses just 1 bit in the null bitmap.
  • Alignment padding rounds column offsets to 4 or 8 bytes, adding invisible overhead.
  • TOAST-able columns (>2KB in PostgreSQL) are compressed and stored out-of-line automatically.
  • MySQL InnoDB stores rows in 16 KB pages with ~50–75% fill factor due to B-tree structure.

Column Type Size Reference

Common column sizes in bytes: BOOLEAN=1, SMALLINT=2, INT=4, BIGINT=8, FLOAT4=4, FLOAT8=8, NUMERIC=variable (2 bytes per 4 digits + 8 overhead), TIMESTAMP=8, DATE=4, UUID=16, TEXT/VARCHAR=actual length + 1–4 bytes, JSONB=actual size + 4 bytes.

Page Overhead and Fill Factor

Database pages (8 KB in PostgreSQL, 16 KB in MySQL) have headers that waste some space. The fill factor setting controls how full each page is packed—lower fill factors (e.g., 70%) leave room for updates but waste more space. Default is usually 90–100%.

Validating Estimates

Always validate estimates against reality. In PostgreSQL: SELECT pg_size_pretty(pg_relation_size('tablename')). In MySQL: SELECT data_length FROM information_schema.tables WHERE table_name='tablename'. Compare periodically and adjust your model.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • Row overhead includes the tuple header (version info, transaction IDs, null bitmap pointer) that the database engine stores with every row. PostgreSQL uses 23 bytes, MySQL InnoDB uses 13–20 bytes, SQL Server uses 7–14 bytes depending on null columns.