Building a SQL Database from Scratch: B-Trees, ACID, and Storage Engines

Added:

Project Intro
Naive Storage
Indexing Need
B-Tree Basics
Disk Storage
Demo & Features
Page Design
Row Storage
SQL Pipeline
Advanced Ops

Project Intro

0:00
Playing Section
  • 1

    Series starts building fundamental software from scratch.

  • 2

    Current goal is to demystify database internal workings.

  • 3

    Identifies missing knowledge about B-Trees and disk storage.

Proficiency in Rust programming, particularly understanding ownership, borrowing, lifetimes, and concurrency primitives.
Fundamental data structures and algorithms, specifically tree-based structures (like Binary Search Trees) and basic complexity analysis (Big-O).
Operating system concepts, including memory management, file I/O operations, page caching, and disk persistence.
Basic familiarity with relational database concepts and standard SQL syntax from an application developer's perspective.
Distributed consensus protocols (such as Raft or Paxos) to transition the database from a single node to a distributed system.
Advanced query optimization techniques, including cost-based optimization (CBO) and vectorized query execution.
Alternative storage architectures, such as Log-Structured Merge (LSM) Trees commonly used in write-intensive NoSQL databases.
Multi-Version Concurrency Control (MVCC) implementations to allow high-concurrency reads and writes without locking.
317.6K views17.6Klikes42:00@tony_saroOriginal Release: 2024-05-09

Databases store data in files organized into pages (typically 4KB), using B-Trees for efficient indexing where each node can hold multiple keys and children, enabling O(log n) search time; the system uses slotted pages for variable-length records, overflow pages for large rows, and implements transaction management through journal files for commit/rollback, with query execution involving parsing, query planning, and execution via iterators that process data one row at a time.