T
traeai
登录
返回首页
ByteByteGo Newsletter

B-Trees vs LSM Trees: Comparison and Trade-Offs

5.0Score
B-Trees vs LSM Trees: Comparison and Trade-Offs
AI 深度提炼

B-Trees vs LSM Trees: Comparison and Trade-Offs

![Image 2: ByteByteGo Newsletter](http://blog.bytebytego.com/)

[ByteByteGo Newsletter](http://blog.bytebytego.com/)

Subscribe Sign in

B-Trees vs LSM Trees: Comparison and Trade-Offs

![Image 3: ByteByteGo's avatar](https://substack.com/@bytebytego399569)

ByteByteGo

Apr 23, 2026

∙ Paid

75

1

Share

Every database has to solve the same basic problem.

Data lives on disk, and accessing disk is slow. Every read and every write eventually has to reach the disk, and how a database organizes data on that disk determines everything about its performance.

Over decades of research, two dominant approaches have emerged.

  • B-Trees keep data sorted on disk so reads are fast, but pay for it on every write.
  • LSM Trees buffer writes in memory and flush them to disk in bulk, making writes cheap but reads more expensive.

Neither approach is better. They represent two different approaches, and understanding the tradeoff between them is one of the most useful mental models in system design.

In this article, we will look at B-Trees and LSM trees in detail, along with the trade-offs associated with each of them.

![Image 4](https://substackcdn.com/image/fetch/$s_!zFEV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F745700fd-435c-44be-b049-ae5bc1392636_2250x2624.png)

The Problem with Disk Access

Image 5: User's avatar

Continue reading this post for free, courtesy of Alex Xu.

Claim my free post

Or purchase a paid subscription.

© 2026 ByteByteGo · PrivacyTermsCollection notice

Start your SubstackGet the app

Substack is the home for great culture

!Image 9!Image 10