korkless wrote:

Is there some formula to know (even if not exactly) 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).

Ann W. Harrison answers:

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 ''.

Like this post? Share on: TwitterFacebookEmail

Related Articles


Firebird Community



Gems from Firebird Support list