{"enrichment":{"faq":[{"a":"storage-format explains how SQLite organizes data on disk starting with a 100-byte header that defines page size, version, and schema metadata. The file is divided into fixed-size pages (typically 4096 bytes), each containing a page header, cell pointers, and cell content. Pages are typed as leaf tables, interior tables, leaf indexes, or interior indexes, arranged in a B-tree hierarchy. The header also stores the freelist root page and total page count, enabling SQLite to manage space and navigate the entire database structure.","q":"What is the SQLite file format structure?"},{"a":"storage-format details how SQLite uses B-tree pages to organize table and index storage. Interior pages contain keys and child page pointers for navigation; leaf pages hold actual records. Each page has a page header (8\u201312 bytes) followed by a cell pointer array and free space. Cells are variable-length records stored from the page end backward. The B-tree structure allows efficient range queries and insertions. Turso's storage engine implements this same layout, enabling compatibility with standard SQLite tools while supporting distributed features.","q":"How does SQLite store data on disk using B-trees?"},{"a":"storage-format distinguishes interior and leaf pages in SQLite's B-tree. Interior pages store keys and pointers to child pages, directing searches downward through the tree. Leaf pages store actual data cells\u2014for tables, the full record with rowid; for indexes, the indexed columns and rowid. Interior pages have a right-child pointer; leaf pages do not. Both page types share the same header format but differ in cell content. This separation enables efficient tree navigation and keeps leaf pages focused on data storage.","q":"What are B-tree interior vs leaf pages in SQLite?"},{"a":"storage-format explains SQLite's overflow mechanism for records exceeding available cell space. When a record is too large, the cell stores a pointer to an overflow page chain. The first overflow page contains a link to the next overflow page and partial record data; subsequent pages continue the chain. This design avoids fragmenting leaf pages and keeps them efficient for typical records. The overflow structure is transparent to queries but critical for debugging large-value storage and understanding space usage in real databases.","q":"How does SQLite handle overflow pages for large payloads?"},{"a":"storage-format describes how SQLite encodes records using serial types. Each record begins with a varint header specifying the number and types of columns. Serial types encode data type (NULL, integer, float, blob, text) and length, allowing SQLite to parse variable-length fields without schema lookups. Text and blob types include length in the serial type; integers use 1\u20138 bytes depending on value. This compact encoding minimizes storage and enables fast deserialization during query execution.","q":"What is the SQLite record format with serial types?"},{"a":"storage-format provides guidance for inspecting database files using hex editors, the SQLite command-line tool, and Turso-specific debugging commands. You can examine the 100-byte header to verify page size and schema version, then navigate pages by offset to inspect B-tree structure, cell layouts, and freelist chains. Understanding page types, cell pointers, and record formats lets you trace data organization and diagnose corruption or space issues. Turso's storage engine maintains standard SQLite format, so these inspection techniques apply directly.","q":"How can I debug and inspect Turso/SQLite database files?"}],"shadow_tags":["on-disk-layout","binary-format","page-management","tree-structures","data-serialization","storage-engine","database-internals","file-parsing"],"summary_rewrite":"This guide breaks down how SQLite organizes data on disk, from the 100-byte header through page types, B-tree layouts, and cell formats. It covers record encoding with serial types, overflow page chains for large payloads, and freelist structures for space reuse. Includes Turso implementation details and debugging commands."},"files":[{"bytes":3790,"path":".claude/skills/storage-format/SKILL.md","sha256":"2a01b17ecf4ba252d49e4663ae5e7a1f0381c15a0f6cc44d3286c514594b9358","url":"https://skillfed.io/files/tursodatabase/turso/storage-format/5b8ec20b/SKILL.md"}],"id":"tursodatabase/turso/storage-format","links":{"html":"https://skillfed.io/tursodatabase/turso/storage-format","md":"https://skillfed.io/tursodatabase/turso/storage-format.md","repo":"https://github.com/tursodatabase/turso"},"meta":{"agents_supported":["claude-code"],"first_seen":"2026-07-28","forks":1211,"language":"Rust","last_updated":"2026-07-28","license":"MIT","name":"storage-format","publisher":"tursodatabase","stars":23479},"relations":{"similar":[{"id":"tursodatabase/agent-skills/turso-db"},{"id":"tursodatabase/turso/debugging"},{"id":"tursodatabase/turso/differential-fuzzer"},{"id":"tursodatabase/turso/mvcc"},{"id":"itechmeat/llm-code/turso"},{"id":"tursodatabase/turso/transaction-correctness"},{"id":"tursodatabase/turso/cdc"},{"id":"tursodatabase/agent-skills/turso-cloud"},{"id":"tursodatabase/turso/testing"},{"id":"tursodatabase/turso/yield-injections"}]},"slug":{"owner":"tursodatabase","repo":"turso","skill":"storage-format"},"version":"5b8ec20b"}
