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

Assume a database tables with the following fields: ID (4 bytes), Name (25 bytes

ID: 668081 • Letter: A

Question

Assume a database tables with the following fields:

ID (4 bytes), Name (25 bytes), age (4 bytes), DoB (10 bytes), gender (1 Byte), Address (60 bytes), state (2 bytes).

Each record on disk has a header part of size 8 bytes.

a) What will be the record size if each field has to start at 4-byte boundaries?

b) What will be the record size if each field has to start at 8-byte boundaries?

c) Assuming a disk block of size 4K bytes, the block uses 64 bytes of its own header (block header). How many records can fit in one block? Report the number under the 4- and 8-bytes boundaries.

Explanation / Answer

Answer

a.

Record Size = record header + record fields

Record Size : (8+8+8+8+8+8+8)+(0+21+0+6+0+56+0)= 139 bytes

b.

Record Size = record header + record fields

Record Size: (8+8+8+8+8+8+8)+(0+17+0+2+0+52+0)=127 bytes

c.

Given,

Block Size : 4096 bytes

Record Header : 64 bytes

For the 4- bytes boundaries

Record Size = record header + record fields

Record Size : (64+64+64+64+64+64+64)+(0+21+0+6+0+56+0)

                       448+83= 531 bytes

Records can fit in one block :

                        Floor(4096/531) = 7

For the 8- bytes boundaries

Record Size = record header + record fields

Record Size : (64+64+64+64+64+64+64)+(0+17+0+2+0+52+0)

                       519 bytes

Records can fit in one block :

                        Floor(4096/519) = 7

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote