Skip to content
Back to the catalog
Project sqlite-readerDatabasesAdvancedBeta

Read a SQLite file

Open a real .db, walk its B-trees and run SELECTs. Reverse engineering of a documented binary format.

Build it in your language

The tester treats your program as a black box: any language works. These are just the most convenient ones for this project.

Guide language

The stage guides read in this language. Only languages this project is fully translated into show up here; the interface language does not change.

What this project is about

SQLite is probably the most widely deployed piece of software in the world, and its file format is documented down to the last byte. It's the perfect target for learning to read on-disk data structures.

You'll open a real .db — not a toy one — and walk it yourself: header, pages, B-trees, records. You'll finish running SELECT queries with WHERE over real tables, using indexes so you don't scan everything.

Roadmap

10 stages across 4 phases. Every stage comes with its guide and its tests: you move on when they pass.

  1. Phase 13 stages

    Opening the file

    Header, page size, schema and table listing.

    1. 01SQLite header
    2. 02Page access
    3. 03sqlite_schema table
  2. Phase 23 stages

    Reading rows

    B-tree traversal, varints and record decoding.

    1. 01Varints
    2. 02B-tree pages
    3. 03Record format
  3. Phase 32 stages

    Querying

    A SELECT parser, WHERE filters and column projection.

    1. 01SELECT parser
    2. 02Scan and filter
  4. Phase 42 stages

    Using indexes

    Index B-trees and queries that avoid the full scan.

    1. 01Index B-tree
    2. 02Query plan

Before you start

A SQLite database reader: header and schema parsing, page and B-tree traversal, record format decoding with variable-length integers, a SQL parser for SELECT with WHERE, and index usage where indexes exist.

  • key-value-db
    Beta

    A key-value database

    A storage engine with a WAL, indexes and compaction. Understand how and when your data is persisted.

    Advanced14 stages~22 hDatabases
    walíndicescompactación+1

    Go · Rust

  • redis
    Beta

    Build your own Redis

    Implement the RESP protocol, an event loop and key expiry. A real server that talks to redis-cli.

    Intermediate10 stages~14 hDatabases
    resptcpeventos+1

    Go · Rust · Python

  • vector-search-engine
    Beta

    Build a vector search engine

    Build a vector index with exact search, filters, and a simplified HNSW graph.

    Advanced5 stages~18 hDatabases
    vectoresbusqueda aproximadahnsw+1

    TypeScript · Python · Go