I’m trying to calculate the number of data blocks given the following table
custNr : 8 character customer number. vehType : 5 character type of vehicle (e.g., TRUCK, SUV, VAN, ) vehMake : 12 character make of vehicle ageRangeCd : customer's age range, this is 1 byte lastActivityDate : 4 byte date representing the last activity for this row customer's email : max of 250 character, average of 36 characters customer's streetaddress : max of 150 characters. These average is 40 bytes.
1. There are 10,000,000 rows and 1 row = 1 customer 2. Data and index blocks are 4096 bytes. 3. Row Id has 2 bytes. 4. email and streetAddress each will use a one byte length. Near the beginning of the row, there will be an additional 2 byte offset to access the streetAddress that follows the email.
I have so far:
The average row size = 8 + 5 + 12 + 4 + 1 + 36 + 40 + 2 (2 bytes from row ID)+ 2(byte offset for streetAddress and email) = 110
rows per data block = (4096) / 110 = 37 (took the floor)
No. data blocks = 10,000,000 (size of record) / 37 (rows/db) = 270271
This is what I came up with, however please tell me if the way I calculated the number of data blocks is wrong.