Subject Re: [firebird-support] char vs varchar
Author Helen Borrie
At 01:38 PM 21/01/2005 +0000, you wrote:



>Just learned that varchar is a variable length string, but always
>takes up the max length size in the database - thanks to Helen.

Umm, no...

>Therefore my assumption of varchar being slower than char was
>apparently wrong.

I told you that varchar was faster *on the wire* than char, because char is
passed with blank-padding up to the declared length.


>Is there a data type that takes up a variable amount of space in the
>database, depending on the actual content?

Both varchar and char are compressed for storage. As I told you, varchar
uses an extra 2 bytes to store the length of the actual data.

>I sometimes have a
>situation, where a field could take anything from 1 to 10000 chars.
>Would I need to take any precautions with respect to performance?

As I and others mentioned in the other list, use varchar for variable
strings of all sorts; use char for short, fixed length strings.

./heLen