Row Size Calculator for Databases

July 23, 2026

Database Capacity Planning

Row Size Calculator

Estimate unique table row sizing from fixed columns, variable text, nullable bitmap overhead, row headers, alignment padding, JSON and blob fields, compression, fillfactor, and page layout.

Schema presets
Table workload
Sets default page size, row header, page reserve, and variable-column metadata.
Rows in the base table, before indexes or replicas.
Database block or page size used for row packing.
Page header, line pointers, slot array, and page bookkeeping estimate.
Lower values leave update space but reduce rows per page.
Applied to compressible payload, not all row metadata.
Use 0.80 for 20% savings, 1.00 for none.
Optional total storage factor for indexes, MVCC dead rows, and free space.
Adds padding after the logical row to mimic row-store alignment.
Columns by type
2-byte smallint, boolean groups, enum-like status fields.
4-byte int, foreign keys, counters, quantities.
8-byte ids, snowflakes, timestamps stored as integers.
Average 12 bytes each; tune with custom fixed bytes below.
4-byte date fields such as birth date or business date.
8-byte created, updated, deleted, event, or valid-time columns.
16-byte identifier fields.
Use for fixed char, IP address, geometry id, bitmask, or proprietary types.
Average fixed payload bytes for the custom fixed-width type.
Variable, nullable, and large fields
Variable text fields stored inline on average.
Average bytes after character encoding, not declared max length.
Length prefix or offset-array cost per variable column.
Inline average for structured documents or schemaless attributes.
Use the stored representation average: text JSON, JSONB, XML, or similar.
Binary values, images, payload captures, or serialized objects.
Inline bytes only unless off-row threshold is disabled.
Large JSON/blob values above this are modeled as a pointer plus external storage.
Inline pointer or root structure left behind when values spill.
Columns that need null bitmap tracking.
Reduces average payload for nullable variable columns in this estimator.
Tuple header, record header, flags, transaction fields, or row metadata.
Average row bytes
0 B
aligned and compressed
Includes header, null bitmap, variable metadata, and padding.
Rows per page
0
at selected fillfactor
Uses page size minus reserve and fillfactor.
Table size
0 GB
base heap or clustered data
Before optional index multiplier.
Overhead percent
0%
metadata and padding share
Header, bitmap, variable metadata, padding, and page reserve.
Ready to calculate row-store density.

Byte breakdown

Fixed-width payload0 B
Variable text payload0 B
JSON/blob inline payload0 B
External JSON/blob storage0 B/row
Row header and null bitmap0 B
Variable metadata and pointers0 B
Alignment padding0 B
Compressed inline row0 B

Capacity results

Usable bytes per page0 B
Total data pages0
Base table storage0 GB
External large-value storage0 GB
Estimated with multiplier0 GB
Payload efficiency0%
Engine: PostgreSQL heap Columns: 0 Large fields: inline
Data type byte table
Type familyTypical bytesHow the calculator uses itPlanning note
Boolean / smallint1 to 2Modeled as 2 bytes per small integer column.Some engines pack booleans better; many schemas still pay alignment elsewhere.
Integer4Modeled as 4 bytes per int column.Common for foreign keys, counters, status ids, and dimensions.
Bigint8Modeled as 8 bytes per bigint column.Use for large ids, epoch timestamps, monotonic ids, and counters that may exceed int.
Decimal / numeric8 to 20Modeled as 12 bytes per numeric column.High precision decimals often cost more than float or scaled integer storage.
Date3 to 4Modeled as 4 bytes per date column.Business dates are compact and usually cheaper than timestamps.
Timestamp8Modeled as 8 bytes per timestamp column.Time zone metadata may be normalized or stored separately by the engine.
UUID / GUID16Modeled as 16 bytes per UUID column.Random UUID primary keys can also increase index page churn.
Varchar / textAverage length plus metadataUses count times average length, adjusted for null rate.Use measured averages from production, not declared varchar limits.
JSON / XMLHighly variableUses average inline bytes or an off-row pointer above threshold.JSONB, XML, and compressed document formats can change row density sharply.
Blob / LOBHighly variableUses average inline bytes or an off-row pointer above threshold.Keep binary payloads off hot OLTP rows when scans and cache density matter.
Row-store comparison grid

PostgreSQL heap

Often modeled with a larger tuple header, null bitmap, line pointer, 8 KB pages, fillfactor, MVCC versions, and TOAST pointers for large values.

MySQL InnoDB

Clustered primary key rows live in B-tree pages. Variable fields, NULL flags, record headers, page directory slots, and overflow pages affect density.

SQL Server

Rows include status bytes, fixed and variable column areas, null bitmap, slot array, page header, and optional row or page compression savings.

Oracle heap

Block overhead, row directory, row headers, trailing null handling, PCTFREE, chaining, migration, and LOB storage all influence usable row density.

Schema preset reference
PresetTypical tableDominant width driverWhat to verify
User ProfileAccount and profile tableVarchar fields and JSON preferencesEmail/name averages, profile JSON size, soft-delete columns.
Order HeaderCommerce order masterMoney columns, addresses, timestampsAddress text averages and nullable promotion fields.
Event LogAppend-only application eventsJSON event propertiesTOAST or overflow behavior for large payload spikes.
IoT TelemetrySensor readings by deviceTimestamp and numeric samplesWhether repeated metadata belongs in dimensions.
Ledger EntryAccounting or wallet ledgerDecimal and UUID columnsPrecision choice, partitioning, and index multiplier.
CMS ArticleContent metadata and bodyLong text and JSON SEO metadataInline body storage versus external content store.
Inventory SKUProduct catalog inventoryText attributes and numeric stock fieldsAttribute JSON growth and nullable dimensions.
Session StoreLogin/session recordsBlob token or serialized stateExpiry policy, compression, and off-row pointer cost.
Audit TrailChange history tableBefore/after JSON payloadsRetention, compression, and external payload size.
Metrics RollupAggregated time-series tableNumeric measuresColumn count and rollup grain before adding indexes.
Media MetadataFile records and transformsJSON metadata plus URLsKeep binaries out of the hot metadata table.
Wide AnalyticsMany-dimensional fact tableLarge count of fixed and nullable columnsPadding, nullable bitmap, and columnar alternatives.
Row sizing tips
Measure real averages. Declared lengths such as varchar(255) rarely match stored averages. Pull average octet length from representative production data when possible.
Separate hot and cold columns. Moving large JSON, notes, and blobs out of frequently scanned tables can improve cache residency and rows per page.
Account for nullable columns. A null bitmap can look small, but many nullable fields also hide variable metadata, sparse access patterns, and poorer compression.
Use fillfactor deliberately. Lower fillfactor can reduce page splits and row movement for update-heavy tables, but it increases table GB immediately.
Compression is not free. Row or page compression can cut storage and IO, but CPU cost and update behavior should be tested with the actual workload.
Include off-row storage. JSON, XML, text, and blob values may leave a compact pointer in the row while consuming space elsewhere in the table space.
This calculator is an engineering estimate for row-store planning. Exact storage varies by engine version, page format, collation, encoding, compression dictionary, MVCC state, index layout, and maintenance history.

Three months after deployment, you may find your disk usage exploding for no obvious reason. It’s hardly ever because of some huge column. Instead, it is because of small amounts of extra space used for row headers, null bitmaps, padding for alignment and variable-length metadata. These are bytes that don’t even show up in your SQL definition.

These are the ones that determine how many rows will fit on each database page, which means they affect how much memory your app ends up using. The calculator above let you guess at this density, turning abstractions into bytes before schema becomes production size.

Why Small Details Use Lots of Space

Take the varchar field. How many times have you seen a developer specify varchar(255) as max length? Why do they do that? To be safe! Well here’s the deal… The storage engine doesn’t give a crap about the upper bound. It cares about content you store. And if your average email address is 48 bytes long, then thats what counts when it comes to row size. In nearly every moddern row store, declared length doesn’t matter at all.

It may matter for validation logic, but it won’t impact how much space you consume on disk. That is what the tool wants to know, the average length. That determines the size of variable offset array. That determines how much space the actual data take up. This makes a huge difference for cache efficiency because you’re saving terabytes of wasted space.

Columns with fixed widths may appear simple at first glance, but they also has their little details. If you place a two-byte field next to an eight-byte one, it might be padded with extra bytes. They are always four bytes wide. Eight bytes wide? It is usually eight. But wait, here’s where databases get clever: They line up data on memory boundaries. This is for performance.

You put a column that’s two bytes wide beside another thats eight bytes wide? Often there will be padding bytes inserted. Why? So it’s clean. And this alignment needs no consideration from you in your code, yet it’s very real on disk. To make up for this, the calculator takes into account physical layout.

It factors in the null bitmap and the row header. The bitmap allows tracking which columns are potentially NULL. It’s tiny per-row but it adds up over millions of rows. This is especially true if you’re dealing with dozens of nullable column.

These may be binary large objects or other types of fields that often spill to another storage area on the page. That way the main page isn’t too big, then it just stores a pointer in the row. The pointer is far smaller than the data itself. If most of your data spools off-page, this means that your main table doesn’t become bloated. It doesn’t store giant amounts of data which aren’t ever read fully. Knowing what spills and what doesn’t change everything about how you store. You may believe you’re storing five hundred bytes per row, half of it has actually been stored somewhere else.

The other factor is the page size/fillfactor. How densely does it pack your data? Typically, an 8k page size is used. With a low fillfactor (leaving free space on each page for updates), you trade off density for performance when writing to disk. That’s important for highly-changing tables. To gain write performance, you sacrifice density. You want to avoid page splits and fragmentation because they hurt insert performance. You tune this with the fillfactor to lessen those effects. This calculator allows you to turn that knob. Want write speed at any cost? Then you can estimate how much more space you’ll be paying for in raw form.

Another wrinkle in this story is compression. This will greatly reduce amount of space used on text heavy rows. It will also use CPU when reading or writing that data. How this helps you realy comes down to what workloads you’re running. For a simple key value lookup, the CPU cost of compression might not be worth the storage savings. But if you have an analytical scan across millions of rows, you’ll probably want to use data compression to cut down on IO. Different levels of compression ratio is modeled so you can see how much overall row size is going to change.

So why does all this matter? Database performance is ultimately about prediction. What you don’t measure, you can’t optimize. Knowing how every column type impact your overall row size helps you make smarter decisions. And those decisions are tied to partitioning and indexing.

More nullable columns means wider tables (with greater overhead). Hot data should be kept dense so that more rows will fit inside memory. This, in turn, run faster without any additional hardware. The point is, the more useful data we can cram into the cache, the better. Understanding the hidden cost of storing stuff makes it impossible to guess. You begin building intentionally rather than blindly.

And that clarity transforms a brittle system into a strong one. It is capable of scaling without crumbling underneath itself. You now have perfect knowledge of how much each slice of information actualy requires.

Row Size Calculator for Databases

Related posts

Leave a Comment