Subject Re: [firebird-support] null field size
Author Ann W. Harrison
korkless wrote:
> hi all, there's same formula to know (even if not exactly) to know how much space is used by a null field and by a column of nulls (i have same columns where only < 1% of the fields are not null).

In memory, a record consists of a record header, one bit for each
field to represent its null state then rounded up the nearest multiple
of eight, plus the declared size of each field. Fields with the null
bit set are filled with zeros for numeric and date types, and spaces
(IIRC) for character and varchar fields.

Before begin written to disk, the whole record undergoes run length
compression using a byte counter. So a string of null numbers turns
into a byte of length and a byte of zero. Nulls take just as much
(or as little) space as the same field with a value of 0 or ''.


Cheers,

Ann