Practice this topic in a realistic system design interview
A query like SELECT * FROM users WHERE id = 5000000 should not have to scan every row in the table. With an index, the database can go almost straight to the row it needs.
Most relational databases build those indexes with a B-Tree, or a close variant called a B+ Tree. A B-Tree keeps keys sorted, handles inserts and deletes efficiently, and needs only a few disk reads to find a key, even in a table with hundreds of millions of rows.
In this chapter, we will learn what a B-Tree is, why databases use it to store indexes on disk, how searches, inserts, and deletes work, and the trade-offs that come with it.
Loading simulation...