writeonce/docs/stories/databasev2
shoney.arickathil 882c1f7d24 feat(db2-keys): task 7 — measure resident: keys against swapping
- two tables identical except the annotation, 200k rows, 40k reads in
  one key order, WAL on ext4 (not /tmp, which is tmpfs here and would
  have put the log in RAM), rootless cgroup v2 cap
- WIDE shape, 2.55x smaller resident set: 34.4 MB vs 87.5 MB. That is
  the real win and the thing the mode was built for
- under a 48 MB cap (between the two resident sets): keys 19635 ops/s
  vs all 12854 — only 1.53x faster than letting the kernel swap
- degradation is far gentler though: all collapses 105x from its own
  uncapped throughput, keys 16x
- costs 4.2x read throughput when memory is not tight, and writes are
  markedly slower — the keys fill did not finish in 2 min where the
  resident fill plus 40k reads did. No design doc had costed writes
- THE UNANTICIPATED FINDING: cgroup limits charge the PAGE CACHE, so
  moving rows to a file does not escape a container memory limit. WAL
  37 MB + RSS 34 MB cannot both live under a 48 MB cap, so every pread
  reaches disk. The premise "the page cache will hold the hot rows"
  fails in exactly the deployment this targets
- first attempt used Int-only rows and showed parity; recorded, because
  drop_payload frees a field's VALUE and an Int's value is its inline
  slot word, so that shape cannot benefit and would have condemned the
  feature for the wrong reason
- verdict: keep it, to fit ~2.5x more data in given RAM — not to make
  an over-capacity table fast

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 7cba9b1174b0bf581314b3147e25cc49e6f49464)
2026-08-30 20:38:03 +02:00
..
00-story.md docs(db2-chains): spec + story for bounding a row's delta chain 2026-08-30 20:38:03 +02:00
01-ram-ceiling-measurement.md feat(db-bench): replay baseline — boot cost tracks history, not data 2026-08-27 21:25:24 +02:00
02-table-storage-modes.md feat(db2-keys): task 7 — measure resident: keys against swapping 2026-08-30 20:38:03 +02:00
03-wal-checkpoint.md docs(db2-keys): reconcile databasev2 and porch markdown with the code 2026-08-30 20:36:55 +02:00
04-io-uring-commit.md Merge master into db-residency-doctrine — and close the two half-exposed features 2026-08-29 10:14:25 +02:00
05-bounded-tables-eviction.md docs(databasev2): propagate iteration 1's findings to every consumer 2026-08-27 22:47:37 +02:00
06-cold-tiering.md docs(db2-keys): reconcile databasev2 and porch markdown with the code 2026-08-30 20:36:55 +02:00
07-single-file-db.md docs(stories): add readiness, retire status: refine, sweep all 47 iterations 2026-08-27 16:54:45 +02:00
08-query-grammar-corpus.md docs(stories): add readiness, retire status: refine, sweep all 47 iterations 2026-08-27 16:54:45 +02:00
09-cross-program-tables.md docs(stories): add readiness, retire status: refine, sweep all 47 iterations 2026-08-27 16:54:45 +02:00
10-keypair-attach-auth.md docs(stories): add readiness, retire status: refine, sweep all 47 iterations 2026-08-27 16:54:45 +02:00
11-bounded-delta-chains.md docs(db2-chains): spec + story for bounding a row's delta chain 2026-08-30 20:38:03 +02:00