5 ms·
> B-tree databases like SQLite compress well Curious, why is this?
by mwint 4y ago
> B-tree databases like SQLite compress well
Curious, why is this?
- tptacek 4y agoThis question nerd-sniped me. I don't know either but my first guess, supported by hex dumping a medium-sized database, is that sqlite B-tree pages are collections of 32-bit page offsets that the database is designed to cluster (also, just lots and lots of zeroes). Also, the database I looked at was mostly UTF-8 text, which is obviously compressible, but I don't think that's what Ben meant.
- benbjohnson 4y agoLitestream author here. When a page gets full then it splits in two so each new mode has empty space for inserts and updates. That empty space compresses really well. Also, OLTP data can have duplication when you have a categorical column that you haven’t moved into a separate table (eg a “type” column that has a couple unique values).