Subject Re: [firebird-support] Varchar size overhead
Author Alexandre Benson Smith
Hi Douglas !

Douglas Tosi wrote:
> Hello!
>
> 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...

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

see you !

--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br