Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Non-leaf nodes "records" contain </p> <ul> <li>a pointer (a node "address" of sorts) to a node in the next level down the tree</li> <li>the value of the key of the first (or the last, depending on implementation) record in that node</li> </ul> <p>Such non-leaf "records" are listed in key order so that by scanning (or binary searching within) a non-leaf node, one knows which node in the next level down <em>may</em> contain the searched value.</p> <p>Leaf nodes records contain complete data records: the key value and whatever else.</p> <p>Therefore <strong>"real" data is only contained in the leaf nodes, the non-leaf nodes only contain [a copy of] the key values. <em>for a very small proportion of the data</em></strong> (this proportion depends on the average number of data records founds in a leaf node).</p> <p>This is illustrated in the following image from the <a href="http://en.wikipedia.org/wiki/B%2B_tree" rel="nofollow noreferrer">Wikipedia article on B+ Trees</a> <img src="https://upload.wikimedia.org/wikipedia/commons/a/a8/Btree.png" alt="simple btree"></p> <p>The non-leaf node, at the top, (the only one in this simplistic tree) only contains two non-leaf node records, each with a copy of a key value (bluish color) and a pointer to the corresponding node (gray color). This tree happens to only have two levels, therefore the "records" in root node point to leaf nodes. One can imagine that there are additional levels (above the topmost tree shown below, call it the "3-5 node"); if that were the case the node above would contain (along with other similar records), a record with key value 3 with a pointer to the "3-5" node.<br> Also note that only the key values 3 and 5 are contained in non-leaf nodes (i.e. not even <em>all</em> key values are reproduced in the non leaf-nodes).<br> BTW in this example the non-leaf nodes contain the key of the <em>last</em> record in the next node (would also work if the <em>first</em> record were used instead, slight difference in the way the search logic is then implemented).</p> <p>The leaf nodes contain the key value (in bluish color too) and the corresponding data record (d1, d2... shown in grey). The red-ish pointer shown at the end of each leaf node point to the next leaf node, i.e. the one containing the very next data record in key order; these pointers are useful to "scan" a range of data records.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload