Unformatted text preview:

Assume a relation R(A,B,C) with primary key A is stored using a B+-tree using attribute C as the search key of the B+-tree (the intermediate nodes only contain attribute C and node pointers, whereas the leafs contain the tuples of the relation R). Attribute A requires 4 Byte of storage, attribute B requires 4 Byte of storage and attribute C requires 8 byte of storage; B+-tree node pointers require 2 Byte of storage; R contains 1000000 (1 million) tuples, and we assume that one block can store 4096 Byte, and that 4000 Bytes are available in a block to store B+-tree entries.Ungraded Homework3 COSC 3480 Fall 20031) B+-Trees Assume a relation R(A,B,C) with primary key A is stored usinga B+-tree using attribute C as the search key of the B+-tree (the intermediate nodes only contain attribute C and node pointers, whereas the leafs contain the tuples of the relation R).Attribute A requires 4 Byte of storage, attribute B requires 4 Byte of storage and attribute C requires 8 byte of storage; B+-tree node pointers require 2 Byte of storage; R contains 1000000 (1 million) tuples, and we assume that one block can store 4096 Byte, and that 4000 Bytes are available in a block to store B+-tree entries.a. What parameters p and m would you choose for the B+-tree? p*2 + (p-1)*8 <= 4000 p = 400m = 4000/(4+4 + 8) m = 250b. Now assume that the following query Q1 is given that returns 2000 answers: Select A from R where C < 5523 and C > 2345How would you implement Q1 trying to take advantage of the B+-tree? Using the results of question a, compute the number of block accesses of the best implementation of the query as precisely as possible, and explain your computations! Assume that nodes are completely filled. Use attribute C as search key of the B+-tree, start from the root, search for an entry with C > 2345, then go to the next level until leaf. The number of blocks accessed is the sum of the intermediate nodesand the leaf nodes accessed.Because p * m = 400 x 250=100,000 < 1,000,000 p * p * m = 400 * 400 * 250 > 1000000the height of the tree is 3; number of intermediate nodes accessed is 2.Number of blocks accessed = (height-1) + (#returned entries/m)= 2 + (2000 / 250)  10c. Assume the above B+-tree with each node corresponding to one block on the disk is given. Assume an entry in this tree is added to a B+-tree of height 3 (that is, it has a root an intermediate layer and a leaf layer). How many different blocks have to be accessed (using read or write) in the worst case to perform this insertion? Give reasons for your answer! 7; worst case scenario: the leaf has to be split (2 block accesses); the intermediate layer has to be split (2 block accesses); the root level has to be split (3 block accesses; 2 for the nodes at the new intermediate level and one forthe root.d. Assume that the following B+-tree with p=5 and k=3 is given. Furthermore, assume that the keys 1, 21, 24, 99 are deleted in the indicated order. Show how the tree looks likeafter each deletion. 3521 2440 43 551 2123 2431 3539 4042 4351 5566 99Delete 1Delete 21 Delete 24 Delete 99Important: The B+-tree insertion and deletion algorithms only work on a single path of the tree accessing the nodes of the tree on this path (and possibly a single neighbor of the node in the path)4021 23 2443 5524 3566 9951 5542 4339 4031 354023 2443 5524 3566 9951 5542 4339 4031 3535 40 43 5566 9951 5542 4339 4023 31 3535 40 4351 55 6642 4339 4023 31 352) Extendible Hashing Consider an extensible hash structure where buckets can hold only two records is used. Initially the structure is empty. Assume the records, listed below, are inserted using the extensible hashing algorithm (we indicate the hashed key in parenthesis in binary format). Show how the hash-table and directory looks like after these records have been inserted (also indicate the local depth of each bucket)! Assume that the least significant bits are used for hashing records to buckets. a [000010] b [111110] c [010111] d [000000] e [101011] f [010111] g [101100] h [011011] i [011010] j [001110]0000010100111001011101113dgaihejbfc333322Homework2: Problem2b:R(A,B,C,D, E) with AC and BCER(A,B,C,DE) R3(A,C) R4(A,B,D,E) AC ABEThe decomposition is dependency not preserving. The attribute closure for {B,C}+={B,C} does not contain E; therefore, BCE is lost!!Remark: The decomposition is lossless because AC holds (this was not asked)Homework2: Problem2c:Candidate key for R is {ABD}Homework2 Problem3: (Does EDABC hold): (1)A BC given(2)C A given(3)E A given(4)BA given(5)E BC transitivity with (3) and (1)(6)E ABC union with (3) and (5)(7)ED ABCD augmentation for (6)(8)ED  ABC decomposition for


View Full Document

UH COSC 3480 - COSC 3480 HOMEWORK 3

Download COSC 3480 HOMEWORK 3
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view COSC 3480 HOMEWORK 3 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view COSC 3480 HOMEWORK 3 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?