B-tree disk read requirement 解释想要

B-tree disk read requirement explanation wanted

在维基百科 B 树的 "Time to search a sorted file" 部分,它说

With 100 records per block, the last 6 or so comparisons don't need to do any disk reads—the comparisons are all within the last disk block read.

https://en.wikipedia.org/wiki/B-tree#Time_to_search_a_sorted_file

问题:20次比较,为什么最后6次比较不需要读盘?

最后 6 次比较都是针对读入内存的最后 100 条记录块进行的:2^6 = 64,并且 64 < 100。

B 树:每次查找都会将前一次查找 space 减半(参见 "divide and conquer")。到域缩小到该级别时,所有数据都是 'physically very close together'。在此示例中,这是在已读入内存的连续 100 条记录的单个块内,从而避免了额外的 IO 读取。

之前的 (14) 次比较很可能必须读取 不同的 records/record 块 - 不包括缓存 - 会导致 IO 读取。