When it comes to choosing, using, and maintaining a database, understanding its internals is essential. But with so many distributed databases and tools available today, it's often difficult to understand what each one offers and how they differ. With this practical guide, Alex Petrov guides developers through the concepts behind modern database and storage engine internals.
Throughout the book, you'll explore relevant material gleaned from numerous books, papers, blog posts, and the source code of several open source databases. These resources are listed at the end of parts one and two. You'll discover that the most significant distinctions among many modern databases reside in subsystems that determine how storage is organized and how data is distributed.
This book examines:
• Storage engines: Explore storage classification and taxonomy, and dive into B-Tree-based and immutable Log Structured storage engines, with differences and use-cases for each
• Storage building blocks: Learn how database files are organized to build efficient storage, using auxiliary data structures such as Page Cache, Buffer Pool and Write-Ahead Log
• Distributed systems: Learn step-by-step how nodes and processes connect and build complex communication patterns
• Database clusters: Which consistency models are commonly used by modern databases and how distributed storage systems achieve consistency
Alex Petrov is a data infrastructure engineer, database and storage systems enthusiast, Apache Cassandra committer, and PMC member. How expertise is in storage, distributed systems, and algorithms.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
# Database Internals: A Deep-Dive into How Distributed Data Systems Work
## 【One-Line Pitch】
A practical, engineering-focused tour of how modern databases actually work under the hood—from storage engines and file organization to distributed consistency—written for developers who want to make informed choices when selecting, tuning, or building data systems.
## 【Book Arc】
- **Opening (~0%–10%)**: Introduces the book's core premise—that the most meaningful differences between databases lie in their storage organization and data distribution subsystems. Sets up the taxonomy of storage engines, DBMS architecture, memory- versus disk-based systems, and row- versus column-oriented layouts.
- **Early (~10%–30%)**: Dives into B-Tree fundamentals, starting from binary search trees and tree balancing, then adapting these concepts for disk-based storage. Covers the physical characteristics of hard disk drives and solid-state drives that shape database file design.
- **Middle (~30%–60%)**: Explores storage building blocks—how database files are organized using auxiliary structures like Page Cache, Buffer Pool, and Write-Ahead Log (WAL). Moves into immutable Log-Structured storage engines, comparing them against B-Tree approaches with use-case guidance.
- **Late (~60%–85%)**: Transitions to distributed systems fundamentals—how nodes and processes connect, communicate, and build complex interaction patterns. Covers the step-by-step mechanics of distributed coordination.
- **Ending (~85%–100%)**: Examines database clusters and consistency models—which consistency approaches modern databases commonly use and how distributed storage systems actually achieve consistency in practice.
## 【Key Takeaways】
- **Storage organization defines database identity** (Early): The most significant distinctions among modern databases live in subsystems controlling storage organization and data distribution—not in SQL dialects or APIs. Understanding these subsystems lets you predict how a database will behave under real workloads.
- **B-Trees are engineered for disk physics** (Early): B-Tree design starts from binary search trees but adapts to the realities of hard drives and SSDs—minimizing seeks, optimizing block sizes, and balancing tree height against I/O cost. This is why B-Trees remain foundational despite their age.
- **Memory- versus disk-based designs change durability trade-offs** (Early): Whether a DBMS keeps data in memory or on disk fundamentally alters its architecture, and memory-based stores require special attention to durability guarantees. Column- versus row-oriented layouts further differentiate systems for analytical versus transactional workloads.
- **Auxiliary structures make storage efficient** (Middle): Page Cache, Buffer Pool, and Write-Ahead Log are the unsung heroes of database performance—they determine how files are organized, how writes become durable, and how reads avoid hitting disk. These building blocks are where much of the real engineering effort goes.
- **Log-Structured storage offers an immutable alternative** (Middle): Immutable Log-Structured engines provide a different trade-off profile than B-Trees—better write performance and simpler concurrency, but with compaction and read amplification costs. Choosing between them depends on your workload's read/write ratio.
- **Distributed systems are built from communication patterns** (Late): Complex distributed behaviors emerge from simpler building blocks—how nodes connect, exchange messages, and coordinate. Mastering these patterns is prerequisite to understanding replication, partitioning, and failure handling.
- **Consistency is a spectrum, not a binary** (Ending): Modern databases implement various consistency models, and distributed storage systems achieve consistency through specific mechanisms. Knowing which model a system implements—and how—tells you what guarantees you can rely on.
## 【Reading Tips】
- **Skim the taxonomy chapters** if you already know the difference between row- and column-oriented stores—the early classification material is useful orientation but moves quickly into familiar territory.
- **Deep-read the B-Tree and Log-Structured sections** if you're choosing between databases like PostgreSQL, MySQL, Cassandra, or RocksDB—this is where the practical trade-offs that affect your daily work actually live.
- **Pay special attention to the auxiliary structures** (Page Cache, Buffer Pool, WAL)—these are the mechanisms that determine real-world performance, and they're often glossed over in other books.
- **Treat the distributed systems part as a foundation course**—the communication patterns and consistency models here are the vocabulary you need to evaluate claims about "eventual consistency" or "linearizability" in vendor documentation.
- **Use the resource lists at the end of Parts I and II** as a reading path for deeper dives—the author explicitly curated papers, blog posts, and open-source code that extend each chapter's material.
## 【Coverage Limits】
The excerpts cover the book's front matter, table of contents, and introductory framing in detail, but do not include substantial content from the middle or ending chapters—so specific technical details on B-Tree variants, Log-Structured Merge trees, or distributed consensus algorithms are not covered in this guide. The book's full table of contents confirms these topics are present, but their treatment cannot be summarized from the available material.
##
Excerpt 1
书名: Database Internals A Deep-Dive into How Distributed Data Systems Work (Alex Petrov) (Z-Library) 作者: Alex Petrov When it comes to choosing, using, and mai...
ll rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reill...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Database Internals A Deep-Dive into How Distributed Data Systems Work (Alex Petrov) (Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Database Internals A Deep-Dive into How Distributed Data Systems Work (Alex Petrov) (Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment