Subject Re: [firebird-support] How varchar columns are stored in FB?
Author Alexandre Benson Smith
At 12:19 18/03/2004 -0800, you wrote:

>Hi,
>
>This is a newbie question. How VARCHAR columns are stored in FB? If I have a
>varchar(6000) column but most of the time the real data are less than 300 in
>length, will FB pad the unused space?
>
>Or put it in another way, For a varchar(6000) column, will a string of 300
>characters occupy the same store space as a string of 5000 characters in FB?
>I of course hope that shorter string will take less space but is that what
>FB doing?
>
>Note I am not talking about transporting varchar between client and server
>for I know FB 1.5 support the compact form of varchar now.
>
>Thank you.


Hi,

AFAIK the algorithm used can compress each 500 bytes to 2 bytes so an empty
6000 varchar will use at least 24 bytes, if you use 300 bytes and this can
be compressed to 100 byes (for example), the other 5700 will be compressed
to 24 bytes, so the total space will be something near 124 bytes, I think
some bytes could be added for control and size storage... Anyone will
correct me if this is wrong... the collation will influence the size too...

See you !


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

----------


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.631 / Virus Database: 404 - Release Date: 17/03/2004


[Non-text portions of this message have been removed]