Skip to content

Menu

Database Size Estimator

Estimate table/index storage sizes

Runs entirely in your browserDatabaseFree, no sign-up
Loading tool

01What is Database Size Estimator?

How big will this table get? That question usually comes up before the table exists, when there is nothing to measure yet. This estimator answers it with the PostgreSQL heap page layout described in the official docs under Database Page Layout. Every row starts with a 23-byte tuple header, which Postgres pads to 24 bytes. Fixed-width types such as INTEGER, BIGINT, UUID, BOOLEAN and TIMESTAMP add exactly their size. Variable-length types (VARCHAR, TEXT, NUMERIC, JSON, BYTEA) add your average size plus a varlena header: 1 byte for values up to 126 bytes, 4 bytes above that. The row total is then rounded up to a multiple of 8. Any column averaging more than 2,000 bytes is treated as TOASTed. The row keeps an 18-byte pointer and the full value is counted in a separate TOAST figure. Rows are packed into 8 KB pages with a 24-byte page header, a 4-byte item pointer per row and a 90% fill. Indexes are modelled as B-trees at 70% fill, which is roughly what an index looks like after random inserts. A freshly built B-tree packs its leaves tighter, at 90%. Each index entry is an 8-byte tuple header plus the indexed columns, padded to 8 bytes, plus a 4-byte line pointer. The tool counts leaf pages, one internal level and a root page. Here is a quick worked case. A table with an INTEGER id and a BOOLEAN flag holds only 5 bytes of data per row. Add the 24-byte header and round up, and each row is 32 bytes. At one million rows that comes to about 38.3 MB of heap plus 27.4 MB for the primary key index. We built it as a planning model, so treat the numbers as a starting point. It skips per-column alignment padding, NULL bitmaps, TOAST compression, the free space map and visibility map, and dead tuples left by updates. Expect the real figure to drift from the estimate, often by a noticeable margin on busy tables. Once the table exists, pg_total_relation_size() gives you the true number. Your column definitions stay in the page and are never uploaded. The results panel shows Table Data, TOAST Data, All Indexes, Total and a per-index breakdown.

Backend engineers and DBAs who need a rough PostgreSQL table and index size before a schema change or a hosting decision. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Database Size Estimator

  1. Pick the Users table, Events table or Products table example to load realistic columns and indexes.
  2. Set the Row Count you expect the table to reach.
  3. Edit each column's Name, choose its type and adjust the Average size in bytes. Add a column with the plus button or remove one with the trash icon.
  4. Read Table Data, TOAST Data, All Indexes and Total, then check the Index breakdown and the Row size line.
  5. Click Copy for a plain-text summary, or the Reset button to go back to the users preset.

03Worked examples

Input: Users preset: id BIGSERIAL, email avg 30, name avg 20, password_hash avg 60, active BOOLEAN, created_at TIMESTAMP; indexes pk_users(id), idx_users_email(email); 100,000 rows
Result: Table: 17.8 MB TOAST: 0 B Indexes: 8.8 MB (pk_users 2.8 MB, idx_users_email 6.1 MB) Total: 26.6 MB Row size: ~160 bytes
The email index is more than twice the size of the primary key index because each entry carries the email bytes.
Input: Events preset: 5 columns incl. payload JSON(medium) avg 500 bytes; 3 B-tree indexes; 10,000,000 rows
Result: Table: 6.36 GB TOAST: 0 B Indexes: 1.02 GB (pk_events 274.1 MB, idx_events_user_id 274.1 MB, idx_events_type_created 494.5 MB) Total: 7.38 GB Row size: ~568 bytes
500 bytes is under the 2,000-byte TOAST threshold here, so the whole payload stays in the main heap.
Input: id INTEGER (4), flag BOOLEAN (1); index pk(id); 1,000,000 rows
Result: Table: 38.3 MB TOAST: 0 B Indexes: 27.4 MB Total: 65.7 MB Row size: ~32 bytes
Five bytes of data still make a 32-byte row once the 24-byte tuple header is added and the total is rounded to 8.
Input: id BIGINT (8), doc JSON(large) avg 5000; no indexes; 100,000 rows
Result: Table: 6.4 MB TOAST: 476.8 MB Indexes: 0 B Total: 483.2 MB Row size: ~56 bytes
The 5,000-byte value is counted in TOAST and leaves an 18-byte pointer in the row, so the main heap stays small.
Input: UUID id (16) + INTEGER (4), pk on id, 10,000,000 rows vs BIGSERIAL id (8) + INTEGER (4), same index
Result: UUID: Table 554.1 MB, Indexes 384.9 MB, Total 938.9 MB, Row ~48 bytes BIGSERIAL: Table 467.8 MB, Indexes 274.1 MB, Total 742.0 MB, Row ~40 bytes
Two runs shown side by side. The 8 extra bytes per key add up in both the heap and the primary key index.

04Common use cases

  • Estimating disk needs for an events or audit-log table you expect to reach ten million rows
  • Comparing the footprint of a UUID primary key against BIGSERIAL before picking one
  • Picking a storage tier for a managed Postgres plan on RDS, Cloud SQL or Supabase before a launch
  • Showing a team how much a JSON payload column weighs compared with a few normalised columns
  • Checking whether a wide text column will spill into TOAST and leave the main heap small
  • Seeing how much a second-column index adds before you write the migration that creates it

05Tips

  • Indexes come from the presets and cannot be added in the UI, but their sizes do follow your column edits. Rename a column and its index falls back to an 8-byte guess.
  • For VARCHAR and TEXT, enter what you really store, not the declared limit. Postgres only writes the bytes in use.
  • The model assumes a freshly packed table. Add headroom for dead tuples if the table sees heavy UPDATE or DELETE traffic.
  • Postgres compresses TOASTed values, so large JSON or text columns usually take less disk than the TOAST figure shows.
  • Column order changes real alignment padding in Postgres, which this model ignores. Putting 8-byte columns first can save space in practice.

06Related concepts

PostgreSQL heap pages, TOAST, B-tree index, Fill factor, Capacity planning.

Frequently Asked Questions

What is Database Size Estimator?

Database Size Estimator is a free, browser-based developer tool on AIDToolStack. Estimate table/index storage sizes It requires no installation or sign-up and works entirely in your browser.

Is Database Size Estimator free to use?

Yes. No sign-up, no fees and no usage cap.

Does Database Size Estimator store my data?

No. It runs in your browser; nothing is uploaded.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe