Subject Re: [IBO] IBOGrid and varchar problem
Author Helen Borrie
At 12:59 PM 21/01/2005 +0000, you wrote:
>In my case, the actual content of the varchar field is much much
>shorter than max field length.
>Not sure if I got your point about char vs varchar right. Clearly,
>char(10000) is a bad idea. I dind't find char(200) that bad. Quite a
>few fields have a size between 30 and 100 in by database and I tend to
>use varchar only for fields having a potentially large size.

That is wrong-thinking. Use char for fixed-length fields only. The "var"
in "varchar" means "varying". It is *designed* for variable length strings.

>Reason to prefer char for most fields was performance. I was assuming
>that char would be more efficient than varchar with respect to speed.
>Is that wrong?

Yes, quite wrong. If you are using Firebird 1.5, varchars travel across
the wire at actual data length + 2 bytes. Chars are padded with blanks out
to their full length. There is a small saving of 2 bytes in storage
only. Chars are stored without the 2 bytes storing their length, of
course, since their length is defined by their type.

>(This is probably something to ask in the Firebird-general newsgroup.)

No. Firebird-general is not a support list. But you should ask such
questions in firebird-support.