2011 级南航工硕士好心人 数据库系统实现习题 - 1 - 2.3.4 假定我们有一个由 10000000个元组构成的大关系,并且按照排序码(唯一地标识记录)的顺序存储。同时假设,关系 R存储在一个块的序列中。假定磁盘块是 4096字节。这样,我们可以将 40个 100字节的记录装填到块中,剩余的 96字节可以作为某些簿记功能或留着不用。这样,关系占据 250000个块。块的位置是已知的,因此对于任何一个 i,用一个磁盘I/O来定位和检索 R的第 i块是可能的。给出一个码值 K,通过使用标准的二分法搜索技术,我们能够找到包含该码值的元组。要找到包含码 K的元组所需要的最大磁盘 I/O数是多少? 答案: Binary search requires probing the block in the middle of the 250,000 blocks, then the one in the middle of the first or second half, and so on, for log_2(250,000) = 18 probes, until we can narrow down the presence of the desired record on one block. Thus, we require 18 disk I/O's. 二进制搜索需要探测在 250,000块,然后在第一或第二的一半的中间一个中间块,等log_2(250,000)=18探头,直到我们能够缩小所需的存在一个块的纪录。因此,我们需要 18磁盘 I / O的。 2.4.2 假设我们使用两台Megatron 747 磁盘互相作为镜像。然而,我们使第一个磁盘的磁头保持在柱面的靠内的一半,第二个磁盘的磁头保持在柱面靠外的一半,而不是允许从两个磁盘都能读任何的块。假设读请求是对随机的磁道,我们始终不必去写: a)系统能够读块的平均速率是多少? b)这个速率与无任何约束的镜像Megatron 747 磁盘的平均速率相比如何? c)你预计该系统的缺点是什么? Recall that the Megatron 747 has a transfer time (in milliseconds) of 0.5, and an average rotational latency of 7.8. If the average seek moves 1/3 of the way across 4096 tracks, the average seek time for the Megatron 747 is 1 + .002*(4096/3) = 3.7. Thus, the answer to part (a) is one block per 0.5 + 7.8+ 3.7 = 12 milliseconds, or 83 blocks per second, on each disk. Thus, the system can read 166 blocks per second. For a ``regular'' Megatron 747, the average latency i...