SQLite is ~35% faster than the filesystem for 10KB blobs — here's why the syscall overhead adds up

arpit_bhayani · x · 2026-11-20

The author explains why SQLite beats raw files for small blobs: each file read pays open/read/close syscalls, directory lookups and permission checks — 100,000 times for 100,000 files — while SQLite keeps one file open and reads via B-tree lookups in the page cache. Filesystems allocate in 4 KiB blocks (a 10KB file costs 12 KiB), whereas SQLite packs records tightly into pages. Atomic updates of 50 files need temp files, fsyncs and renames with raw IO; SQLite gives journal-based atomic commits out of the box. Trade-offs: the advantage fades for larger blobs, single-writer is a real limit, and one huge DB file is harder to inspect.

Original post →

More from Infra

Infra channel →