tursodatabase avatar

Storage Format

If you're working with Turso or need to understand how SQLite actually stores data on disk, this breaks down the file format internals. You get the page structure, B-tree organization, cell formats, overflow chains, and freelist management with actual byte offsets and diagrams. It points you to the relevant Rust files in Turso's codebase (btree.rs, pager.rs, sqlite3_ondisk.rs) and explains how table rows map to varints and serial types. Useful when you're debugging storage issues, optimizing page usage, or just curious why your database file is structured the way it is. The reference links to SQLite's official docs and Fly.io's internals writeup are solid next steps.

skills.sh installs
1.3K
GitHub stars
25.2K
last updated
Aug 21, 2026

Install

$ npx -y skills add tursodatabase/turso --skill storage-format --agent claude-code

Installs into .claude/skills of the current project.

Files

Storage Format Guide

Database File Structure

┌─────────────────────────────┐
│ Page 1: Header + Schema     │  ← First 100 bytes = DB header
├─────────────────────────────┤
│ Page 2..N: B-tree pages     │  ← Tables and indexes
│            Overflow pages   │
│            Freelist pages   │
└─────────────────────────────┘

Page size: power of 2, 512-65536 bytes. Default 4096.

Database Header (First 100 Bytes)

OffsetSizeField
016Magic: "SQLite format 3\0"
162Page size (big-endian)
181Write format version (1=rollback, 2=WAL)
191Read format version
244Change counter
284Database size in pages
324First freelist trunk page
364Total freelist pages
404Schema cookie
564Text encoding (1=UTF8, 2=UTF16LE, 3=UTF16BE)

All multi-byte integers: big-endian.

Page Types

Sponsors

Details

Repository
github.com/tursodatabase/turso
Categories
Code Review & Quality, Databases
First seen
May 16, 2026

More from tursodatabase/turso

All 14
1vtex avatararchitecture-well-architected-commercevtex/skillsApply when scoping, reviewing, or documenting cross-cutting VTEX commerce architecture across storefront, IO, headless, marketplace, payments, or any other VTEX1.2Kskills.sh installs
2neolabhq avatarattach-review-to-prneolabhq/context-engineering-kitAdd line-specific review comments to pull requests using GitHub CLI API1.2Kskills.sh installs
3liuzhengdongfortest avatarcs-refactor-ffliuzhengdongfortest/codestablecs refactor ff1.2Kskills.sh installs
4sickn33 avatarai-agents-architectsickn33/antigravity-awesome-skillsai agents architect1.2Kskills.sh installs
5cursor avatarreview-plugin-submissioncursor/pluginsAudit a Cursor plugin for marketplace readiness.1.2Kskills.sh installs
6tirth8205 avatarreview-deltatirth8205/code-review-graphReview only changes since last commit using impact analysis. Token-efficient delta review with automatic blast-radius detection.1.2Kskills.sh installs