Toolvito

Calculates on this device. File exports run online.

Database Size Calculator

Describe a table — its columns, how long its text is, how many values are empty, its indexes and how many rows it has — and see how many bytes each row takes in PostgreSQL, MySQL (InnoDB), SQL Server, SQLite or MongoDB, how many rows fit in a page, and the size of the table and its indexes now and as it grows. Every step of the formula is shown, and every overhead of the engine is listed as an assumption. Add up whole databases, or measure a sample of your data to get real average lengths.

Enter your values

A table and its indexes from their columns, with the formula and the engine’s overheads.

Your values

Columns

Other indexes

More options

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose the button below them.

Measure a whole data file

Measure a whole data file

Choose a CSV, TSV, Excel, JSON Lines or Parquet file of up to 1 GB, such as an export of the table. Each column gets the same measures as Measure a sample of data above: average and largest size in bytes, empty share, distinct values and what the values look like.

Or drop files here. CSV, TSV, TAB, TXT, JSON, JSONL, NDJSON, PARQUET, XLSX, XML, YAML, YML, TOML, PLIST, GED, XSD or DTD, up to 20 files, 1 GB each at most.

    More options

    Estimates and samples above stay in your browser. When you use this box, the file you choose and the query shown in the request are sent to the Toolvito server. Download the result within one hour after the job finishes. Choose Delete files now to request earlier removal. The hourly cleanup normally removes files within one to two hours after completion.

    How to use it

    1. Choose Estimate a table, pick the engine, and list the columns with their types. For text, give the average length in bytes; for decimals, the number of digits. Give the share of empty values where you know it.
    2. Add the primary key and the other indexes, the rows you have now and the rows you add each month. Press Estimate the size.
    3. Not sure about lengths? Choose Measure a sample of data, paste a few hundred rows, and use the average bytes it finds.

    What is and is not counted

    • Counted: the engine’s page size and page headers, row headers, null bitmaps, length bytes, alignment padding, hidden columns, and B-tree index entries and pages, as each engine documents them.
    • Not counted: compression, dead rows and bloat after updates and deletes, pages left half full by random inserts, large values stored outside the row (TOAST, off-page, LOB), write-ahead and redo logs, backups and replicas.
    • Treat the result as a careful estimate: check it against a real table of a few thousand rows in your own database.

    Related tools