In order to work out the size of a file you need to know
- How big is the fixed length record
- How many records are going to be stored
The process you follow is straight forward
- Calculate the size of the fixed length records
- Multiply the size by the number of records present
- Add on 10% of the total size.
The 10% may seem strange but it is necessary. This is used to store the files header or metadata. The data stored in the header is information such as
- What fields have been used (data type etc)
- Index and categorization information
- The type of program which created it
- Any security information or application specific information
The metadata will vary from file to file and application to application. This is why the rough value of 10% is used. Estimating the file size is not going to be accurate but it will be within the right area.
Estimate = (Number of records X size of fixed length record) X 1.1
The above formula will work out the estimate, including the 10% extra. For example consider the fixed length records below.
Field name |
Data type |
Size |
First name |
Text |
20 |
Last name |
Text |
30 |
Date of birth |
Date |
6 |
Height (cm) |
Integer |
4 |
Weight (Kg) |
Float |
4 |
Eats school lunch` |
Boolean |
1 |
Storing 342 records gives -
Estimate = (Number of records X size of fixed length record) X 1.1
Estimate = (342 X 65) X1.1
Estimate = 24,453 bytes (23.9 Kb)