

Based on Assumption 1, we need to split the node because the block can only store two values.Īssumption 2: When a node is split, the right value of the left node goes to the higher level However, it will end up with a node with three values “5, 7, 8”. When we insert a new number “8”, we firstly assume that we need to insert it into the existing leaf node. Now, we can insert the first two numbers into the index. But it will make our example much easier to be understood. Of course, in practice, this number is impossibly small. Don’t worry, the mechanism of all B+Tree indexes is the same.Īssumption 1: Each block of the hard disk drive can be stored with two keys Therefore, we need to have some assumptions in our example. It needs to be emphasised that, there is not only one way to build a B+Tree index. For example, the order is as follows: 5, 7, 8, 1, 4, 6, 2, 3, 9 To demonstrate the mechanism in a general case, let’s assume the keys are inserted randomly. Because there is a B+Tree index on the key column, the index will need to be built as the data rows are inserted one by one.Īlthough usually the key field might be inserted in order, of course, that’s not always the case. So, a series of entries will be inserted into the table. Now, suppose we started to use this table. Let’s start from an empty table, and ignore what other columns it has, just focusing on the key column having the B+Tree index created on.
