Subject Re: [firebird-support] Varchar size overhead
Author Hannes Streicher
Guten Tag Douglas Tosi,

am Mittwoch, 21. Januar 2009 um 16:53 schrieben Sie:


> On Wed, Jan 21, 2009 at 1:13 PM, Ivan Prenosil <Ivan.Prenosil@...> wrote:
>>>> Today while doing some tests I noticed something odd:
>>>> Suppose the following tables with varchar fields of different sizes:
>>>> create table test1(t1 varchar(100) character set ascii)
>>>> create table test2(t2 varchar(2000) character set ascii)
>>>>
>>>
>>> FB can compress 512 bytes to 2 if they are the same...

>> Actually, it is just 128 -> 2.
>> i.e. 1968 spaces will be stored in 16*2 = 32 bytes.

> Thanks Ivan. It makes sense now.

not to me ,

from my understanding of VARCHAR it uses a pascal-string like storage
with a stringlength , instead of the CHAR which is space padded ,
so if the varchar is filled with 32 characters

there are no bytes needing to be Run length compressed after these 32
chars as opposed to char which is space padded and thf can be RL
compressed





--
Mit freundlichen GrĂ¼ssen
Hannes Streicher mailto:HStreicher@...