aiylam_s wrote:
I have 2 Firebird databases, each with 10,000 records. The second has 4 VARCHAR columns:
- ID VARCHAR(40) indexed not-null - LOCATION VARCHAR(250) indexed not-null - LOCATION_PART1 VARCHAR(32000) - LOCATION_PART2 VARCHAR(32000)
The size of the first database on disk is 1941504 bytes (~1.9 MB). The size of the second on disk is 14700544 bytes (~14.7MB). Do 20,000 NULLS really take up 12759040 bytes (~12.7MB)? That corresponds to about 638 bytes per NULL! Can anybody shed some light on this?
Ann W. Harrison answers:
Yup. The null is only one bit, but the record is laid out with all fields fully expanded and null fields zeroed or blanked. Then the record is compressed, using a one byte run-length encoding. Up to 127 identical bytes turn into two bytes, which is OK, but not great when you have 32,000 byte fields - that's a bit more than 500 bytes... and I've probably forgotten something.