Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the author
OK
Database Internals: A Deep Dive into How Distributed Data Systems Work
Purchase options and add-ons
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
- ISBN-101492040347
- ISBN-13978-1492040347
- Edition1st
- PublisherO'Reilly Media
- Publication dateNovember 5, 2019
- LanguageEnglish
- Dimensions7 x 0.75 x 9 inches
- Print length370 pages
![]() |
Frequently bought together

More items to explore
- Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable SystemsPaperbackFREE Shipping by AmazonGet it as soon as Thursday, Sep 3
- The Staff Engineer's Path: A Guide for Individual Contributors Navigating Growth and ChangePaperbackFREE Shipping on orders over $35 shipped by AmazonGet it as soon as Thursday, Sep 3
- The Data Warehouse Toolkit: The Definitive Guide to Dimensional ModelingPaperbackGet it as soon as Wednesday, Sep 9
- The DevOps Handbook, 2nd Edition: How to Create World-Class Agility, Reliability, & Security in Technology OrganizationsPaperbackFREE Shipping on orders over $35 shipped by AmazonGet it as soon as Thursday, Sep 3
- System Design Interview – An Insider's Guide: Volume 2PaperbackFREE Shipping by AmazonGet it as soon as Thursday, Sep 3
- Code: The Hidden Language of Computer Hardware and SoftwarePaperbackFREE Shipping by AmazonGet it as soon as Thursday, Sep 3
Customers also bought or read
- Systems Performance (Addison-Wesley Professional Computing Series)#1 Best SellerComputer Performance Optimization
Paperback$57.41$57.41FREE delivery Thu, Sep 3 - Designing Distributed Systems: Patterns and Paradigms for Scalable, Reliable Systems Using Kubernetes
Paperback$45.76$45.76FREE delivery Thu, Sep 3 - Operating Systems: Three Easy Pieces#1 Best SellerComputer Operating Systems Theory
Paperback$28.27$28.27Delivery Thu, Sep 3 - Streaming Systems: The What, Where, When, and How of Large-Scale Data Processing
Paperback$61.21$61.21$3.99 delivery Sep 11 - 18 - Understanding Distributed Systems, Second Edition: What every developer should know about large distributed applications
Paperback$35.00$35.00FREE delivery Thu, Sep 3 - Site Reliability Engineering: How Google Runs Production Systems#1 Best SellerNetwork Disaster & Recovery Administration
Paperback$24.51$24.51Delivery Sep 8 - 15 - Kafka: The Definitive Guide: Real-Time Data and Stream Processing at Scale
Paperback$43.99$43.99FREE delivery Thu, Sep 3 - Patterns of Distributed Systems (Addison-Wesley Signature Series (Fowler))
Paperback$34.60$34.60Delivery Thu, Sep 3 - The Staff Engineer's Path: A Guide for Individual Contributors Navigating Growth and Change
Paperback$26.39$26.39Delivery Thu, Sep 3 - Apache Iceberg: The Definitive Guide: Data Lakehouse Functionality, Performance, and Scalability on the Data Lake
Paperback$44.94$44.94FREE delivery Thu, Sep 3 - Data Engineering Design Patterns: Recipes for Solving the Most Common Data Engineering Problems
Paperback$35.46$35.46FREE delivery Sep 10 - 16 - Cloud Application Architecture Patterns: Designing, Building, and Modernizing for the Cloud
Paperback$18.67$18.67Delivery Thu, Sep 3 - Concurrency in Go: Tools and Techniques for Developers
Paperback$35.68$35.68$3.99 delivery Sep 11 - 16 - Designing Machine Learning Systems: An Iterative Process for Production-Ready Applications
Paperback$40.00$40.00FREE delivery Thu, Sep 3 - McGraw-Hill Education Database System Concepts | 7th Edition
Paperback$34.90$34.90FREE delivery Sep 3 - 4 - Kubernetes: Up and Running: Dive into the Future of Infrastructure
Paperback$43.99$43.99FREE delivery Thu, Sep 3 - Building Secure and Reliable Systems: Best Practices for Designing, Implementing, and Maintaining Systems
Paperback$45.26$45.26FREE delivery Sep 3 - 8 - The Data Warehouse Toolkit: The Definitive Guide to Dimensional Modeling
Paperback$38.71$38.71FREE delivery Sep 9 - 11 - System Design Interview – An insider's guide#1 Best SellerObject-Oriented Software Design
Paperback$39.99$39.99FREE delivery Thu, Sep 3 - Kubernetes in Action, Second Edition: Deploying and managing containers and cloud-native applications
Paperback$54.07$54.07FREE delivery Thu, Sep 3
From the brand
-
Databases, data science & more
-
Data Science
-
Visit the Store
-
Data Visualization
-
Databases
-
Streaming
-
Sharing the knowledge of experts
O'Reilly's mission is to change the world by sharing the knowledge of innovators. For over 40 years, we've inspired companies and individuals to do new things (and do them better) by providing the skills and understanding that are necessary for success.
Our customers are hungry to build the innovations that propel the world forward. And we help them do just that.
From the Publisher
From the Preface
Who is this book for?
In conversations at technical conferences, I often hear the same question: “How can I learn more about database internals? I don’t even know where to start.” Most of the books on database systems do not go into details of storage engine implementation, and cover the access methods, such as B-Trees, on a rather high level. There are very few books that cover more recent concepts, such as different B-Tree variants and log-structured storage, so I usually recommend reading papers.
Everyone who reads papers knows that it’s not that easy: you often lack context, the wording might be ambiguous, there’s little or no connection between papers, and they’re hard to find. This book contains concise summaries of important database systems concepts and can serve as a guide for those who’d like to dig in deeper, or as a cheat sheet for those already familiar with these concepts.
Not everyone wants to become a database developer, but this book will help people who build software that uses database systems: software developers, reliability engineers, architects, and engineering managers.
If your company depends on any infrastructure component, be it a database, a messaging queue, a container platform, or a task scheduler, you have to read the project change-logs and mailing lists to stay in touch with the community and be up-to-date with the most recent happenings in the project.
Understanding terminology and knowing what’s inside will enable you to yield more information from these sources and use your tools more productively to troubleshoot, identify, and avoid potential risks and bottlenecks. Having an overview and a general understanding of how database systems work will help in case something goes wrong. Using this knowledge, you’ll be able to form a hypothesis, validate it, find the root cause, and present it to other project maintainers.
This book is also for curious minds: for the people who like learning things without immediate necessity, those who spend their free time hacking on something fun, creating compilers, writing homegrown operating systems, text editors, computer games, learning programming languages, and absorbing new information.
The reader is assumed to have some experience with developing backend systems and working with database systems as a user. Having some prior knowledge of different data structures will help to digest material faster.
Editorial Reviews
Review
About the Author
Product details
- Publisher : O'Reilly Media
- Publication date : November 5, 2019
- Edition : 1st
- Language : English
- Print length : 370 pages
- ISBN-10 : 1492040347
- ISBN-13 : 978-1492040347
- Item Weight : 2.31 pounds
- Dimensions : 7 x 0.75 x 9 inches
- Best Sellers Rank: #42,920 in Books (See Top 100 in Books)
- #3 in Desktop Database Books
- #5 in Management Information Systems
- #5 in Data Warehousing (Books)
- Customer Reviews:
About the author

Alex is a data infrastructure engineer, database and storage systems enthusiast, Apache Cassandra committer and a PMC member. His expertise is in storage, distributed systems, and algorithms.
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonCustomers say
Generated from the text of customer reviewsSelect to learn more
Reviews with images
One of the Best Books out there
Top reviews from the United States
- 5 out of 5 stars
Great book for backend developers
Reviewed in the United States on July 5, 2026Great book, covers enough to get intuition about databases
Sending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Packed with details, great read
Reviewed in the United States on November 17, 2020Can't believe I forgot to write a review for this one!
Partly it's probably because I usually have less to say (or more precisely it's harder for me to be properly articulate) about things I like than I do about the ones I don't. And boy did I like Database Internals! I'll try my best to explain why, the book and the author surely deserve it.
Being a back-end engineer, the main reason for picking this one up was to better understand the distributed databases that I may end up in (or have already had) contact with. With that in mind, I planned on just skimming the first part of the book but imagine my surprise when I found myself Googling BW and LSM trees and going through papers comparing this and that algorithm and their impacts on memory, storage and CPU caches in multicore systems. The geek got suckered in! With my curiosity circuits pleasantly warmed by the first part, I moved on to the second part of the book - the main dish - where a similar scenario unfolded: again I swallowed up whatever was served and ended up digging for more and adding scores of books and papers to my to-read list.
All in all, Database Internals reads felt a lot like a trip to the zoo or a local museum: chock full of data structures and algorithms used by modern-day databases (and distributed systems in general), the book will showcase each item with sufficient details for you to grasp what they're about and then provide you with enough bibliography and reference material to last you a lifetime... or at least a couple of years.
15 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Worth the effort
Reviewed in the United States on May 19, 2024This book took me a few years to get through. It is much more low-level than something like DDIA. Having worked on database code for the past couple of years, that context was crucial in helping me understand the book. The book is great because it covers all of the important ideas in databases and talks about the tradeoffs of using various algorithms. Succinct, detailed, and quality.
4 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 4 out of 5 stars
Summarized Recent Overview of Storage & Distributed Systems
Reviewed in the United States on November 30, 2019Mastery in systems abstraction comes through a philosophical pivot. While an enthusiastic beginner considers successful "use cases", an experienced traveler - through her implicit awareness of futility against entropy - often only considers failure and just tries her best. As more systems, and more of every system, are being dictated by the twin forces of economics and architectural modernism, a much higher percentage of design and development efforts in software should be dedicated to understanding fundamentals (CPU registers, branch prediction etc.) and essential complexities (multi-node consensus, replication failures etc.). This book is a good start.
Database Internals is divided into two parts - the first deals with database storage. Especially good sections put a 9-cell flash-light on how many recent architectures are indeed built to tackle complexity bottom-up. i.e., LSM (log-structured merge) trees nicely complement the "write amplification" of Solid-State Disks. The discussion on the canonical B-tree and its multiple siblings (especially Bw-tree) is very well done. The functional difference between locks and latches would be enlightening even for experienced database practitioners - locks are used to manage transactions, latches to guard the *physical* storage representation.
The second half of the book focusing on distributed systems is more uneven in quality. It is, however, a great start of economized discussion of about 50 "Best Papers" on Leader Election, Failure/Crash detection, Replication and how distributed systems friendly "consensus protocols", rather than atomic ones like 2-phase commit work better. In many ways, distributed systems have veered from monarchy (single, immutable leader deciding everything, including the next leader) to a true republic (leader is still almost omnipotent, but is regularly replaced by the constituents). The comparative analysis of Paxos, ZAB and Raft - with clear sequence diagrams - is very well done.
The quality of writing is good, though could have been helped with more ruthless editing. The area covered is simply too broad, other than the intersect of SSDs and Modern DB architecture which is very deep and very good. Still the book easily deserves at least 4-stars for the enthusiasm and for its good attempt to convey distributed systems pedagogy to general practitioners. Pair it with Martin Kleppmann's "Designing Data Intensive Applications" and Ken Birman's "Guide to Reliable Distributed Systems".

4 out of 5 starsSummarized Recent Overview of Storage & Distributed Systems
Reviewed in the United States on November 30, 2019Mastery in systems abstraction comes through a philosophical pivot. While an enthusiastic beginner considers successful "use cases", an experienced traveler - through her implicit awareness of futility against entropy - often only considers failure and just tries her best. As more systems, and more of every system, are being dictated by the twin forces of economics and architectural modernism, a much higher percentage of design and development efforts in software should be dedicated to understanding fundamentals (CPU registers, branch prediction etc.) and essential complexities (multi-node consensus, replication failures etc.). This book is a good start.
Database Internals is divided into two parts - the first deals with database storage. Especially good sections put a 9-cell flash-light on how many recent architectures are indeed built to tackle complexity bottom-up. i.e., LSM (log-structured merge) trees nicely complement the "write amplification" of Solid-State Disks. The discussion on the canonical B-tree and its multiple siblings (especially Bw-tree) is very well done. The functional difference between locks and latches would be enlightening even for experienced database practitioners - locks are used to manage transactions, latches to guard the *physical* storage representation.
The second half of the book focusing on distributed systems is more uneven in quality. It is, however, a great start of economized discussion of about 50 "Best Papers" on Leader Election, Failure/Crash detection, Replication and how distributed systems friendly "consensus protocols", rather than atomic ones like 2-phase commit work better. In many ways, distributed systems have veered from monarchy (single, immutable leader deciding everything, including the next leader) to a true republic (leader is still almost omnipotent, but is regularly replaced by the constituents). The comparative analysis of Paxos, ZAB and Raft - with clear sequence diagrams - is very well done.
The quality of writing is good, though could have been helped with more ruthless editing. The area covered is simply too broad, other than the intersect of SSDs and Modern DB architecture which is very deep and very good. Still the book easily deserves at least 4-stars for the enthusiasm and for its good attempt to convey distributed systems pedagogy to general practitioners. Pair it with Martin Kleppmann's "Designing Data Intensive Applications" and Ken Birman's "Guide to Reliable Distributed Systems".
81 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
I've been looking for this book for years
Reviewed in the United States on April 16, 2021I've been looking for a book that covers these topics for a long time. Even just working with different databases on a day-to-day basis it's incredibly helpful to understand how components of each database actually work. Furthermore the topics covered in this book span a very wide array of different topics and techniques which are incredibly handy for distributed systems. It's really hard to find this much information in a single book. Usuaully you'd have to know each of the topics you're interested in and buy an entire book on that topic. This book packs a pretty in depth view on several topics related to database systems into one book without needless fluff.
I highly recommend this book not only to people working on distributed data systems, but to anyone working with databases. This is one of my most frequently referenced books I own.
14 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
One of the Best Books out there
Reviewed in the United States on November 3, 2019This is one of the best texts covering Database internals. Databases are used everyday, and understanding what happens under the hood is daunting task. This book takes a pragmatic approach on the topic, starting with basics and then taking a deeper dive into how the basic data structures and concept come together. IMHO, this book shall appeal to both Database developer's and engineer's who want to understand how databases work. This book is must have to for the engineer's who really want to get into Database development. Otherwise also this book is a must have reference in general. I personally liked the attention to details in the book on what really matter's when writing a real database. The concepts are equally applicable to SQL and NoSQL databases.

This is one of the best texts covering Database internals. Databases are used everyday, and understanding what happens under the hood is daunting task. This book takes a pragmatic approach on the topic, starting with basics and then taking a deeper dive into how the basic data structures and concept come together. IMHO, this book shall appeal to both Database developer's and engineer's who want to understand how databases work. This book is must have to for the engineer's who really want to get into Database development. Otherwise also this book is a must have reference in general. I personally liked the attention to details in the book on what really matter's when writing a real database. The concepts are equally applicable to SQL and NoSQL databases.
11 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
A Great Resource for Understanding Database Internals
Reviewed in the United States on November 3, 2019This is an amazing book about the internal workings of a database. I highly recommend this book if you’re looking to understand how a database actually works. Building a full-featured database is a huge undertaking, but after reading this you should be able to understand how most major databases work and even build your own. It also has a great section that goes over distributed systems.
This is the only book I know of that has all of this information relevant to database design all in one place. As someone who has read a lot of the resources listed in this book (there are a ton!), it’s nice to see all of this information condensed into a single book.
5 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Very knowledgeable and detail oriented but concise at the same time
Reviewed in the United States on December 29, 2024Strong recommend to anyone from a beginner to an expert
One person found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Top reviews from other countries
Vladimir Kazanov5 out of 5 starsA very good book with developers already working with databases and database-like systems
Reviewed in the United Kingdom on February 28, 2020There are two infinitely big and comparably old topics in software engineering: compilers and databases. Both have traditions and history, both are recognised as deep research topics, with developers and academics working on related problems for decades.
It's really hard to get an overview of the way databases work, given how diverse and, well, *big* they really are. Decades of practical experience don't mean one has a clear understanding of query processing, optimisation, storage subsystems, transaction processing, concurrency control, etc.
Sometimes, just sometimes, mortals get lucky and somebody writes a survey of a subfield, or an extended overview, of relevant problems. Best example I am aware of: the Red Book aka Readings in Database Systems. It's a vast survey of academic work on databases. But it's more of a collection of paper references than a linear reading.
Database Internals also feels a bit like an extended survey: numerous paper references are, no code, mostly conceptual explanations. What stands out is its good linear narration, gradually coming up with definitions and clarifying explanations.
So, what this book is not: introductory text, a textbook, theory-centric volume or practise-centric work.
What this book is: a survey of typical approaches to two major aspects of databases (local storage subsystems and problems of distributed systems). Interested reader will have to follow the references, casual reader will get familiar with terminology and common concepts in a condensed way.
I would (and definitely will) recommend the book to people already working with databases for at least a few years looking for additional insights or an overview of the field.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Clément Grimault5 out of 5 starsGreat book
Reviewed in Spain on July 2, 2023Amazing book, in my top 3 technical books. I learned a lot, it goes really deep and explains everything very well. I would suggest to have at least a good understanding of database basics before starting though (indexes, distributed systems)
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
hailizhang5 out of 5 starsGreat value with true knowledge!
Reviewed in Canada on August 27, 2025The book is really good, mint without any scratches. Love it!
5 out of 5 starsGreat value with true knowledge!
Reviewed in Canada on August 27, 2025The book is really good, mint without any scratches. Love it!
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Amazon Customer5 out of 5 starsGood read, and came in well wrapped
Reviewed in India on February 12, 2026I read other reviews, which said "this book is very technical". That made me think, that this book is going to have source code of database internals..
But, these are just theories.
Because, of that i am a little disappointed.
If you are an experienced programmer, then you can read and absorb this books content in single day.
It is a good book, otherwise.

5 out of 5 starsGood read, and came in well wrapped
Reviewed in India on February 12, 2026I read other reviews, which said "this book is very technical". That made me think, that this book is going to have source code of database internals..
But, these are just theories.
Because, of that i am a little disappointed.
If you are an experienced programmer, then you can read and absorb this books content in single day.
It is a good book, otherwise.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Amazon Customer5 out of 5 starsAlles, was man wissen muss.
Reviewed in Germany on December 20, 2025Sehr gute Zusammenfassung for essenzielle Wissen.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again





















