SQLite Freelist Pages Caused OpenCode Database to Balloon Past 1 GB
A developer noticed their OpenCode coding-agent database had grown beyond a gigabyte on a single machine, prompting a closer look at the file's actual contents. Using SQLite diagnostic tools, they found that only around 525 MB was live data, while roughly 766 MB consisted of unused freelist pages that SQLite retains for potential reuse rather than returning to the filesystem. This behavior is by design in SQLite: deleting rows frees internal pages but does not automatically reduce the file size on disk. Coding-agent tools like OpenCode are especially prone to this issue because they store far more per session than typical chat apps, including tool calls, shell outputs, and file contents. The developer emphasized that file size alone is a misleading metric and that SQLite's PRAGMA commands are needed to accurately distinguish live data from reclaimed empty space.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in