SQLite compressed text-history prototypes

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

Developers storing per-edit revision history in SQLite can cut storage dramatically by compressing all prior versions into one Zstandard-compressed JSON blob instead of one row per edit.

Read this as

Simon Willison describes an experimental way to store every past version of a frequently edited document in a SQLite database without ballooning in size. Instead of saving a full copy of the text for each edit, all previous versions are bundled into one compressed JSON array using a compression tool called Zstandard. In a test with 1,000 revisions of a 20.4 MB document, everything shrank to just 80.3 KB. The prototypes were built with help from ChatGPT's voice mode and a model called GPT-5.6 Sol Pro.

This is a personal engineering experiment, not a product: Willison prototyped two SQLite schemes for keeping full text revision history cheaply. A naive one-row-per-edit design costs 20 KB per edit on a 20 KB document, while compressing 1,000 versions into one Zstandard blob cut 20.4 MB to 80.3 KB. The AI-assisted coding workflow, done via ChatGPT voice mode plus a 38-minute GPT-5.6 Sol Pro run, is arguably as notable as the storage result itself. No production tool or release is offered.

Two Python prototypes are compared: WholeBlobHistoryStore rewrites a single compressed blob (a zstd-compressed JSON array of prior texts plus an uncompressed array of Unix timestamps) on every edit, while ChunkedHistoryStore seals chunks of at most 128 revisions or 3 MB uncompressed JSON per row to avoid decompressing and recompressing everything each time. Both preserve prior text and timestamps, skip unchanged replacements by default, and serialize writers using BEGIN IMMEDIATE transactions. 1,000 simulated revisions produced 20.4 MB raw, compressed to 80.3 KB.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

SQLite Zstandard Datasette Pyodide ChatGPT

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading