Subject | Re: [firebird-support] Varchar size overhead |
---|---|
Author | Ivan Prenosil |
Post date | 2009-01-21T15:13:39Z |
>> Today while doing some tests I noticed something odd:Actually, it is just 128 -> 2.
>> 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...
i.e. 1968 spaces will be stored in 16*2 = 32 bytes.
Ivan
>
> In your case you have 1968 trailing spaces for record, so you would have
> 4 chunks of 512 spaces (in fact 3 chunks of 512 and the other of 432),
> this would put an overhead of 8 bytes per record on your varchar(2000)
> column,
>
> The other with the length of 100 would have just 2 bytes to represent
> the 68 trailing spaces, a difference of 6 bytes per record