基础设施 4.0 · 优秀 2026-08-09 · 文章

SQLite compressed text-history prototypes: 20.4MB to 80.3KB

Simon Willison 原型了基于 SQLite 的文本修订历史存储:把所有历史版本放入 JSON 数组再整体压缩1000 次修订的 20.4MB 压缩到 80.3KB分块变体将历史拆成最多 128 次或 3MB 的块以避免全量解压缩

打开原文回到归档

SQLite compressed text-history prototypes

Source: https://simonwillison.net/2026/Aug/9/sqlite-text-history-prototype/
Author: Simon Willison

Summary (EN)

Simon Willison prototyped a SQLite-based text revision history store: bundle all prior versions of a document into a JSON array, then compress the whole blob with zlib or zstd. 1,000 simulated revisions of a 20.4 MB document compressed to 80.3 KB. To avoid decompressing/recompressing the entire history on each edit, the chunked variant breaks history into rows of max 128 revisions or 3MB uncompressed JSON. Two approaches compared: WholeBlobHistoryStore (rewrite one compressed blob per edit) and ChunkedHistoryStore (sealed compressed chunks for scaling). Both skip unchanged replacements and serialize writers with BEGIN IMMEDIATE.

摘要中文

Simon Willison 原型了一种基于 SQLite 的文本修订历史存储方案:把所有历史版本放入 JSON 数组,再整体压缩。1000 次模拟修订的 20.4 MB 原始文本压缩到 80.3 KB。为避免每次编辑都全量解压缩,分块变体将历史拆成最多 128 次修订或 3MB 的块。适合笔记、编辑器、本地工具的实现参考。