---
title: "B-Trees vs LSM Trees: Comparison and Trade-Offs"
source_name: "ByteByteGo Newsletter"
original_url: "https://blog.bytebytego.com/p/b-trees-vs-lsm-trees-comparison-and"
canonical_url: "https://www.traeai.com/articles/b0f73076-2e1a-47f5-92b9-470b52313683"
content_type: "article"
language: "中文"
score: 5
tags: []
published_at: "2026-04-23T15:30:59+00:00"
created_at: "2026-04-23T17:24:01.15967+00:00"
---

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

Canonical URL: https://www.traeai.com/articles/b0f73076-2e1a-47f5-92b9-470b52313683
Original source: https://blog.bytebytego.com/p/b-trees-vs-lsm-trees-comparison-and

## Summary

traeai 为开发者、研究员和内容团队筛选高质量 AI 技术内容，提供摘要、评分、趋势雷达与一键内容产出。

## Key Takeaways

- 
- 
- 

## Content

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

URL Source: http://blog.bytebytego.com/p/b-trees-vs-lsm-trees-comparison-and

Published Time: 2026-04-23T15:30:59+00:00

Markdown Content:
# B-Trees vs LSM Trees: Comparison and Trade-Offs

[![Image 2: ByteByteGo Newsletter](https://substackcdn.com/image/fetch/$s_!1eXV!,w_40,h_40,c_fill,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F8a5609ae-1239-4400-9491-6010a15c4d60_504x504.png)](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://substackcdn.com/image/fetch/$s_!U1Ej!,w_36,h_36,c_fill,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9941c68-e5b7-4b93-be75-df7cc4ffef02_504x540.png)](https://substack.com/@bytebytego399569)

[ByteByteGo](https://substack.com/@bytebytego399569)

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!,w_1456,c_limit,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)](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](https://substackcdn.com/image/fetch/$s_!90Cx!,w_64,h_64,c_fill,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F10cd1afb-9a92-433e-bbf4-f726eb8ffdb3_375x375.jpeg)

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

[Claim my free post](http://blog.bytebytego.com/p/b-trees-vs-lsm-trees-comparison-and)

[Or purchase a paid subscription.](https://blog.bytebytego.com/subscribe?simple=true&next=https%3A%2F%2Fblog.bytebytego.com%2Fp%2Fb-trees-vs-lsm-trees-comparison-and&utm_source=paywall&utm_medium=web&utm_content=195215951&just_signed_up=falsesimple=true&utm_source=paywall&utm_medium=email&utm_content=195215951&next=https://blog.bytebytego.com/p/b-trees-vs-lsm-trees-comparison-and)

© 2026 ByteByteGo · [Privacy](https://substack.com/privacy) ∙ [Terms](https://substack.com/tos) ∙ [Collection notice](https://substack.com/ccpa#personal-data-collected)

[Start your Substack](https://substack.com/signup?utm_source=substack&utm_medium=web&utm_content=footer)[Get the app](https://substack.com/app/app-store-redirect?utm_campaign=app-marketing&utm_content=web-footer-button)

[Substack](https://substack.com/) is the home for great culture

![Image 9](https://t.co/1/i/adsct?bci=4&dv=UTC%26en-US%26Google%20Inc.%26Linux%20x86_64%26255%26800%26600%268%2624%26800%26600%260%26na&eci=3&event=%7B%7D&event_id=8c478062-6724-4375-8b12-f34b7f893554&integration=advertiser&p_id=Twitter&p_user_id=0&pl_id=015b2b68-006c-4236-8b6b-484b2326b020&pt=B-Trees%20vs%20LSM%20Trees%3A%20Comparison%20and%20Trade-Offs&tw_document_href=https%3A%2F%2Fblog.bytebytego.com%2Fp%2Fb-trees-vs-lsm-trees-comparison-and&tw_iframe_status=0&tw_pid_src=1&twpid=tw.1776965023021.257241903246602465&txn_id=oesry&type=javascript&version=2.3.53)![Image 10](https://analytics.twitter.com/1/i/adsct?bci=4&dv=UTC%26en-US%26Google%20Inc.%26Linux%20x86_64%26255%26800%26600%268%2624%26800%26600%260%26na&eci=3&event=%7B%7D&event_id=8c478062-6724-4375-8b12-f34b7f893554&integration=advertiser&p_id=Twitter&p_user_id=0&pl_id=015b2b68-006c-4236-8b6b-484b2326b020&pt=B-Trees%20vs%20LSM%20Trees%3A%20Comparison%20and%20Trade-Offs&tw_document_href=https%3A%2F%2Fblog.bytebytego.com%2Fp%2Fb-trees-vs-lsm-trees-comparison-and&tw_iframe_status=0&tw_pid_src=1&twpid=tw.1776965023021.257241903246602465&txn_id=oesry&type=javascript&version=2.3.53)
