Menu

1 / 3

LSM Trees vs B-Trees: What are they and how to pick one ? (for databases)

DEV Community: sql·Sai Teja·3 days ago
#FAPuCa35
#devtosql#devto#dev#write#tree
Long article (3086 words) — no AI summary yet.
Reading 0:00
15s threshold

When we pick a database, we usually compare the things we can see: the query language, the client libraries, the ecosystem, maybe the pricing. Postgres or MySQL? Cassandra or something else? RocksDB or LMDB if we want an embedded one?

Very few people start with the question of what happens to a key and a value after they are handed to the database. Yet that is the part that decides how fast your writes are, how quickly your SSD wears out, and why your latency graph has a strange spike at 3 AM that nobody can explain.If you don't know about these indexes you will be in a better place after reading this while choosing a database.

That piece of code is the storage engine , and most of them are built on one of two ideas: the B-tree or the LSM tree . This post is about those two.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.