Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume we have the following information about the University database: All tabl

ID: 3828029 • Letter: A

Question

Assume we have the following information about the University database: All tables are stored in packed form in blocks of length 4096 bytes. Student has 10,000 tuples, each 200 bytes long. It is hashed on stuId, the primary key, and has a secondary non-clustered index on lastName, with three levels. There are 8,000 values for lastName, 2,000 values for firstName, 25 values for major, and 150 values for credits. Faculty has 800 tuples of length 100 bytes. It has an index on facld, the primary key, with two levels. There is a secondary non-clustered index on department, with one level. facName has 650 values, department has 25 values, and rank has 4 values. Class has 2, 500 tuples with length of 100 bytes. It is hashed on classNumber, the primary key, and has no secondary indexes, facId has 700 values here, schedule has 35 values, and room ahs 350 values. Enroll has 50,000 tuples with length of 100 bytes. It has a composite index on the primary key, {classNumber, stuId}, with four levels, and it has no other index. The attribute grade has 10 values. a. Find the blocking factor and total number of blocks needed for each of the four relations. Use this information for the questions that follow. b. Calculate the following selection sizes, assuming uniform distribution of attribute values: s(major = 'Art', Student) s(rank = 'Professor', faculty) s(grade = 'A', Enroll) s(room = 'A205', Class)

Explanation / Answer

Student

Index Type

secondary non clustered index with three levels

Block Size

4096 Bytes

Number of Records

10,000

Size of record

200 Bytes

Data blocking factor

Floor(4096/200) = 20

No of data Blocks required

Ceil(10,000/20) = 500

Assume that size of field last name

50 Bytes

Assume that block pointer size is

10 Bytes

Index entry size (last name size + block pointer size)

60 Bytes

No of index entries

10,000

Index Block blocking factor(fan Out)

floor(4096/60) = 68

No of index entries

10000

No of index blocks at 3rd level

Ceil(10,000/68) = 148

No of index blocks at 2nd level

Ceil(148/68) =3

No of index blocks at 1nd level

Ceil(3/68) =1

Total No of blocks (data blocks + index blocks)

500+148+3+1=652

Faculty

Index Type

Primary Key index with two levels

Block Size

4096 Bytes

Number of Records

800

Size of record

100 Bytes

Data blocking factor

Floor(4096/100) = 40

No of data Blocks required

Ceil(800/40) = 20

Assume that size of field facID

20 Bytes

Assume that block pointer size is

10 Bytes

Index entry size (facID size + block pointer size)

30 Bytes

No of index entries

800

Index Block blocking factor(fan Out)

floor(4096/30) = 136

No of index entries

800

No of index blocks at 3rd level

Ceil(800/136) = 6

No of index blocks at 2nd level

Ceil(6/136) =1

Total No of blocks (data blocks + index blocks)

20 + 6 + 1=27

class  

Index Type

hashing

Block Size

4096 Bytes

Number of Records

2500

Size of record

100 Bytes

Data blocking factor

Floor(4096/100) = 40

No of data Blocks required

Ceil(2500/40) = 63

Total No of blocks (data blocks + index blocks)

63 + 0 = 63

Enroll

Index Type

composite index with four levels

Block Size

4096 Bytes

Number of Records

50000

Size of record

100 Bytes

Data blocking factor

Floor(4096/100) = 40

No of data Blocks required

Ceil50000/40) = 1250

Assume that size of field classNUMBER

20 Bytes

Assume that size of field studID

40 Bytes

Assume that block pointer size is

10 Bytes

Index entry size

70 Bytes

No of index entries

50000

Index Block blocking factor(fan Out)

floor(4096/70) = 58

No of index entries

50000

No of index blocks at 3rd level

Ceil(50000/58) = 862

No of index blocks at 2nd level

Ceil(862/58) =14

No of index blocks at 2nd level

Ceil(14/58) =1

Total No of blocks (data blocks + index blocks)

1250+862+14+1=2127

Please let me know in case of any doubts.

Thanks

Index Type

secondary non clustered index with three levels

Block Size

4096 Bytes

Number of Records

10,000

Size of record

200 Bytes

Data blocking factor

Floor(4096/200) = 20

No of data Blocks required

Ceil(10,000/20) = 500

Assume that size of field last name

50 Bytes

Assume that block pointer size is

10 Bytes

Index entry size (last name size + block pointer size)

60 Bytes

No of index entries

10,000

Index Block blocking factor(fan Out)

floor(4096/60) = 68

No of index entries

10000

No of index blocks at 3rd level

Ceil(10,000/68) = 148

No of index blocks at 2nd level

Ceil(148/68) =3

No of index blocks at 1nd level

Ceil(3/68) =1

Total No of blocks (data blocks + index blocks)

500+148+3+1=652