Subject Re: elementary question, blob versus varchar in ib
Author bullardjuk
--- In IBObjects@y..., Frank Ingermann <frank.ingermann@f...> wrote:
>
> fyi: whenever a record is actually written to the gdb, FB/IB
*always*
> performs a run length encoding on the entire record. Iirc, even
64bit ints
> get RLE'd when they are = 0. So from this pov, it makes absolutely
no
> difference whether your field is varchar(1), varchar(100) or varchar
(1000).
> Same goes for char(1) vs. char(1000).
>
> BUT: it does make a *big* difference concerning network traffic.
>
> (i asked the same question some months ago on IB-Support, and Ann
H's
> comment was "Well, somebody had to ask..." ;-) From her explanation
i
> took the following conclusion:
>
> - GDB space is hardly at all affected by the size you declare (-
>RLE)
> - Char vs. Varchar makes a difference of 2 length bytes, that's it.
> - for the network: across the wire always goes the decoded field in
> full length (may it all be blanks, no difference) + the length
info
>
> So a Select that returns 1000 all-blanks char fields will give you
> 1000 * (20+2) for varchar(20), but 1000 * (1000+2) for varchar
(1000) !!
>
> -> my biggest wish for FB2: run length encoding for the network
> transmission! <bg>
>
> fwiw - regards,
> fingerman

Thanks for your help Frank.

That makes things quite a bit clearer to me. Now ALL my data gets
sent from the central database over a telephone line to a
distant 'local' database so this aspect is quite important to me. The
size of the central / local databases will not be significantly
changed by using varchar(1000) instad of a blob. But what is the
network consideration ? Would using a Blob mean that if it is empty
only the pointers would be sent down the line?? !!

I have tried sending the whole database as a windows file and that is
far quicker. But of course not very secure.

Dave