Build a Database from Scratch · 09 B+Tree Search and SELECT



The leaf stores rows, but it cannot say whether a key is there without reading every cell. This stage makes one promise, that the keys in a leaf are always in ascending order, and builds two things on it: a binary search that finds a key in a few comparisons, and a SELECT that reads the table back in order without a sort. This is the ninth stage of Droid, a tutorial where you build a database engine from an empty folder.

This video explains the idea. The stage page has the exact output, the error codes and the tests your program has to pass:

0:00 The problem
0:37 The promise
0:58 Binary search
1:42 Not found is a position
2:28 Insert in order
3:16 Duplicates
3:40 The cursor
4:21 SELECT
5:00 Invariants and next

Next stage: Leaf Splits and the First Internal Node The whole tutorial:

The narration is a synthetic voice.

source

Leave a Reply

Your email address will not be published. Required fields are marked *

You might like

© 2026 Cantinho do Vídeo - WordPress Video Theme by WPEnjoy