Back to feed
Dev.to
Dev.to
7/22/2026
My OpenCode Database Was Mostly Empty Space

My OpenCode Database Was Mostly Empty Space

Short summary

OpenCode's local SQLite database can grow to over 1 GB while most of the file is empty freelist space, not live data. SQLite retains deleted pages inside the file for reuse rather than returning them to the OS, so file size vastly exceeds actual data size. The author provides PRAGMA-based diagnostic queries to measure freelist bytes and recommends VACUUM or auto-vacuum configuration to reclaim space.

  • OpenCode's SQLite DB grew to 1.3 GB but only 525 MB was live data; 56% was freelist space
  • SQLite keeps deleted pages inside the file for reuse rather than shrinking the file
  • PRAGMA page_count, freelist_count, and page_size let you calculate true live data vs wasted space

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more