database - Index table's pages - how many pointers do they contain? -


suppose have file f pages, each page contains 2 tuples, e.g. first 2 pages:

(0, 1) (1, 2) ------ (3, 4) (4, 5) 

suppose want use hash function h(x) = x mod 2 make index table fi file f. assume want apply hash function on first attribute.

hence hashes be:

(0, 1) -> h(0) = 0 (1, 2) -> h(1) = 1 ------ (3, 4) -> h(3) = 1 (4, 5) -> h(4) = 0 

and have 2 buckets, both containing 2 primary pages set null.

bucket 0 [null] bucket 1 [null] 

now can fill buckets pointers, ie:

bucket 0 [(0, 1)*, (4, 5)*] bucket 1 [(1, 2)*, (3, 4)*] 

however, question is, how stored in disk? 1 pointer per 1 page , so:

bucket 0 [(0, 1)*] -> [(4, 5)*] bucket 1 [(1, 2)*] -> [(3, 4)*] 

where -> denotes pointer overflown page.

or 2 pointers per page , no overflown pages? cannot find proper explanation of particular detail.

moreover, when need read tuple given key k, how work need 1 i/o (assuming no overflown pages)? shouldn't 2 i/o, 1 i/o reads page index table fi (e.g. k = 3; hash -> h(3) = 1, read page of bucket 1) , second i/o use pointer provided index table (e.g. (1, 2)* , read actual value @ pointer (ie. in file f)?


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -