Subject | RE: [firebird-support] Varchar - NULL vs blank |
---|---|
Author | Rick Debay |
Post date | 2006-10-19T21:13:52Z |
Thanks. That means it's something I should bother with. Time to
requisition some more storage.
-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Ann W. Harrison
Sent: Wednesday, October 18, 2006 6:26 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Varchar - NULL vs blank
Rick Debay wrote:
then subjected to run-length compression. Both start with
two bytes of zero. The only slight difference is that at the
beginning of the record there's a string of bytes which represent the
null flags. A record with 14 columns will have two bytes of null flags.
If the fourth field is null, the fourth bit of the first byte will be
set. The null bytes are also subject to run length compression. If
none of the fields are null, then the null bytes are all zeros and
compressible. That's a really small difference.
Regards,
Ann
Run length compression works like this. First there's a byte.
If its positive, it's followed by that many bytes of data. If it's
negative, it's followed by one byte to be repeated -1 multiplied by that
number of times. For example, this string of bytes 3, 'a', 'b', 'c',
-4, 'd' represents this string:
'abcdddd'. A 100 byte null varchar would be represented (probably,
depending on what preceded and followed it) as 2, 0, 0, -100, ' '. The
compression is done on row as a whole, not field by field.
requisition some more storage.
-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Ann W. Harrison
Sent: Wednesday, October 18, 2006 6:26 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Varchar - NULL vs blank
Rick Debay wrote:
>For storage, an empty varchar and a null varchar are both blank filled,
> In this case I really need to know if there is a difference in the
> storage requirements.
then subjected to run-length compression. Both start with
two bytes of zero. The only slight difference is that at the
beginning of the record there's a string of bytes which represent the
null flags. A record with 14 columns will have two bytes of null flags.
If the fourth field is null, the fourth bit of the first byte will be
set. The null bytes are also subject to run length compression. If
none of the fields are null, then the null bytes are all zeros and
compressible. That's a really small difference.
Regards,
Ann
Run length compression works like this. First there's a byte.
If its positive, it's followed by that many bytes of data. If it's
negative, it's followed by one byte to be repeated -1 multiplied by that
number of times. For example, this string of bytes 3, 'a', 'b', 'c',
-4, 'd' represents this string:
'abcdddd'. A 100 byte null varchar would be represented (probably,
depending on what preceded and followed it) as 2, 0, 0, -100, ' '. The
compression is done on row as a whole, not field by field.