问题
I got this simple question
Calculate the order p of a B+ tree if B=512, V=9B, Pr=7B and P=6B.
I think the answer is
6p + (p - 1) * 9 < 512
which ignore the Pr
but if change the question is to calculate order p of a B-Tree with same values for B,Pr, P and B then, I think the answer should be
6p + (p - 1) * (9 + 78) < 512
Am I correct on this?
回答1:
Each B Tree node can have at most p tree pointers, and p-1 data pointers and p-1 search key fields values. These must fit into a single disk block if the required B-Tree node must correspond to a disk block.
To calculate p:
6p+(p-1)*(9 + 7) <= 512
6p + 9p + 7p -9 – 7 <= 512
22p – 16 <= 512
22p <= 528
p <= 24
Although p can be a maximum of 24, we choose p = 23 because the B Tree nodes may contain additional information used to manipulate the tree, such as the number of entries q in the node, and a pointer to the parent, therefore before we calculate p above, the block size should be first reduced by the amount of extra space needed.
来源:https://stackoverflow.com/questions/19748506/difference-in-calculating-the-order-for-b-tree-and-b-tree