Subject Re: [IB-Architect] Next ODS change (was: System table change)
Author Ivan Prenosil
> From: Ann Harrison:
> What InterBase currently uses is a run-length compression which is
> cheap to compute. It uses a signed byte to indicate length. A positive
> value of <n> shows that the next <n> characters are part of the record.
> A negative value of <n> shows that the next character (byte value) should
> be repeated <n> times.
>
> If the length indicator were a word, an empty varchar(32000) would be
> stored as three bytes, rather than the current 300 or so.

RLE compression in IB is able to map maximally 128 repeating bytes into 2 bytes
(-128 and the character), so the best achievable compression ratio is 1:64.
It means empty 32000 CHAR will occupy exactly 500 bytes (nice number to remember).

VARCHAR (besides 2 bytes for string length) can be even longer because
IB will not fill rest of string by zeroes (or spaces) when UPDATEing it.


Ivan
prenosil@...