Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hash files?

Status
Not open for further replies.

stigejg

Technical User
Mar 28, 2001
55
NO
Hello,

I am quiet new to the theory of database, I am just started to read about it. And now i have got this question that I don’t find an easy answer for in my book (Database systems, a practical approach to design, implementation and managment).

And since I found this site, I am trying my luck here hopefully to get some answers.

I have got this information and questions:

There is this information about a key-transformed (hash-file) file:

-The transformation-key are the field "code" (two digits).
- The domain for this field is two uppercase letters from the english alphabet.
- The maximum number of posts in the file is 30.
- Fixed post-lenght.
- Number of buckets = 17.
- Fill-factor = 60% +- 10%.
- Owerflow are to be placed in the next available space.

Questions:

a) How many posts must each bucket take?
(are this so simple that I just divide 30 on 17?)

b) What does this mean:
The transformation are based on the ASCII-table, addition and MOD-function?
(is this so simple that I just find the bit-code for the two letters from the ASCII-table for instance A would be 1000001, and if the code is AA I just adds this two values 1000001+1000001 = 10000010 and this is the address to the bucket?)


What would the result be if I reorganize the file to:

- Max number of posts = 50
- Number of buckets = 15 and owerflow-area = 3 buckets
- The rest is the same as above

c) What would the new block (bucket) size be?

Anyone who can give me an easy answer on these questions?
And may be some links to web-pages where I can find some answers to my questions.

Thanks.

Kind regard Stig
 
Question a)

(30/0,6)/17 is the corect. You will need 2,94~3 posts pr bucket.

Question b)

Correct AA => 1000001+1000001 = 10000010 => 130
130 MOD 17(17 buckets) will give you this result:

130/17 = 7,647....
(7,647... -7)*17 = 11

The keyvalue AA goes in to Bucket 17 (if there is some free space).

And you just do the same with the rese of the questions.

Hope this where some help for you.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top