DuckDB against PostgreSQL — 67 times smaller than umami, 22 times smaller than our own

**Our v0.8.0 stores the same traffic in 50.8 MB. Umami — the product whose feature list we follow — needs 3,406 MB for it: 67 times more.** And against our own PostgreSQL backend the gap is 22 times.

This is the story of what the storage engine buys, measured on the same rows, on the same machine, in one round.

The setup

One dataset: three sites, 45 days, 1,000,000 visits, 2,767,665 event rows, 56 columns. Four engines, the same rows, the same machine, one round:

on the diskper viewbulk write100 small batchessummarytop pages
our DuckDB + Parquet cold tier50.8 MB21 B35.1 s88.1 s114 ms25 ms
our ClickHouse65.7 MB27 B43.1 s1,025.2 s20 ms19 ms
our DuckDB (hot tier only)121.4 MB50 B20.6 s98.2 s87 ms10 ms
plausible CE (ClickHouse)92.3 MB38 B26.6 s889.5 s17 ms17 ms
our SQLite1,072.0 MB439 B4.9 s23.7 s1,714 ms470 ms
our PostgreSQL1,110.6 MB455 B11.0 s58.3 s1,860 ms295 ms
umami v3 (PostgreSQL)3,406.0 MB1,396 B87.1 s112.2 s996 ms1,995 ms

All four engines answer the same questions with the same numbers: 846,147 page views, 284,908 visitors, 347,013 visits. That is the part that makes the sizes comparable — same rows, same answers, so only the storage differs.

The two numbers that matter

Against umami: 67 times smaller. 3,406.0 MB against 50.8 MB.

Against our own PostgreSQL backend: 22 times smaller. 1,110.6 MB against 50.8 MB — and our PostgreSQL backend is our code, on our schema, with the same reports.

The 22× is the more interesting one. umami is somebody else's product; we are not going to out-engineer them. But our own PostgreSQL backend — the same rows, the same schema, the same report code — is 22× bigger than our DuckDB. That gap is not about the market. It is about the engine, and it is ours to close.

Why PostgreSQL is 455 bytes a row

Because PostgreSQL is a row store that we are using as a column store — and it stores rows the way rows are stored, one heap page at a time.

Three things follow, and all three show up in the numbers:

  1. Every row carries its own overhead. A tuple has a header, a null bitmap

and an alignment; there is no per-column dictionary and no per-column compression. The same value repeated in a column is stored again and again.

  1. The wide columns are stored as they are. Our event row has a page

title, a referrer path, a user agent, three map columns for the properties. In a row store those are inline, and the page fills with them.

  1. Nothing groups the rows. There is no column segment that can hold

"the same string, forty thousand times" — there is a heap page that holds "one row, in order".

The number that shows it best is the same one the release notes quote for our own id columns: a UUID is 16 bytes and does not compress; a counter is 1 byte and does. In DuckDB the counter was 0.39 bytes a row. In PostgreSQL the id is 16 bytes of UUID in a heap tuple — a thousand times the bytes for the same information.

What each side is good at

bulk writesmall batchessummarytop pages
our PostgreSQL11.0 s58.3 s1,860 ms295 ms
our SQLite4.9 s23.7 s1,714 ms470 ms
our DuckDB + cold tier35.1 s88.1 s114 ms25 ms
umami v387.1 s112.2 s996 ms1,995 ms

PostgreSQL writes faster than DuckDB (11.0 s against 20.6 s for the bulk load — the 35.1 s is that plus sealing the cold tier). because it is a server with a write-ahead log and DuckDB is an embedded engine that rewrites its file. and it reads 16× slower (1,860 ms against 114 ms for the summary). because those numbers are scans over a row store.

That is the trade in one line: a row store writes your rows and reads them one at a time; a column store reads them in columns and writes them in batches.. For an analytics product — where the write is small and rare, and the read is wide and often — the second one wins

Where umami's extra 3× goes

Our PostgreSQL backend is 1,110.6 MB; umami's is 3,406.0 MB. Three times the same rows, in the same kind of database. The difference is in the shape:

  • umami keeps the properties in their own table (one row per property, with the key and the value in columns) — v0.6 of ours did that too, and v0.7 moved them into the event row as three map columns;
  • umami keeps the sessions in their own table, with the session's own fields, and the events point at it;
  • ours keeps one row per event and derives the sessions from it.

. The properties are the big one: in v0.6 our own property table measured 13.9 MB against 375 KB for the same properties in three map columns (−97.3%). Umami's shape is the expensive one, and we already know the way out of it

What we take away

  1. The engine is worth more than the tuning. The same product, the same

rows, the same reports: 22× on the disk between our own PostgreSQL backend and our own DuckDB one.

  1. A row store used as a column store pays for it twice — once in the

per-row overhead, once in the scans.

  1. The shape of the data matters more than the shape of the engine. Umami

is 3× bigger than our PostgreSQL backend in PostgreSQL, and the reason is the property table — which we have already learned to do differently.

  1. PostgreSQL's write advantage is real (11.0 s against 35.1 s) **and it is

the wrong advantage for this product**: 16× slower reads is what a dashboard feels.

Caveats

Our numbers, one round, one machine (macOS/arm64): 1,000,000 visits, 2,767,665 rows, 56 columns. The DuckDB figure includes the Parquet cold tier; without it the hot tier alone is 121.4 MB (50 B per view) — still 9× smaller than our PostgreSQL backend. The measuring tools are private; every number here was measured on the machine above.

Sumimi / 数咪咪 is an independent open-source project. It is an open-source alternative to Umami and implements the Umami v2 HTTP API; no Umami assets are used. Licensed under the Apache-2.0 licence. Third-party names are referenced nominatively.