← ALL NEWS

SIMON WILLISON · 10 Aug 2026

SQLite compressed text-history prototypes

A developer experimented with a new method for storing revision histories of frequently edited text inside a SQLite database column without wasting excessive storage space. Standard approaches often store a full copy of a document for every single edit, which quickly bloats database sizes when documents are large.

The proposed solution stores every prior version of a document inside a single JSON array of strings and compresses the entire collection using Zlib or Zstd algorithms. A separate uncompressed array of Unix timestamps keeps track of when each revision occurred.

Using Python, the developer tested the concept by simulating one thousand revisions of a twenty-kilobyte document. The raw text totaled 20.4 megabytes, but the compression reduced it down to 80.3 kilobytes. To prevent performance lag from decompressing and recompressing the entire dataset on every single change, an automated optimization splits the history into multiple rows once a limit of 128 revisions or 3 megabytes of uncompressed JSON is reached.

This approach matters because it offers an exceptionally space-efficient way to handle full text-history versioning in relational databases. By leveraging strong compression on heavily redundant sequential text data, developers can maintain extensive change logs with minimal storage overhead.

Read the original ↗