Subject Re: RE: [ib-support] Non-technical database question
Author Martijn Tonies

Please don't quote the entire (in this case very very long) message.

> Cassandra,
> Some more comments on data types if I may...
> The use of VARCHAR over CHAR is far more advisable where the size of the
> field is greater than a few characters and the length of such fields
> varies... i.e. it's far more economical to use a null terminated string to
> store a string (VARCHAR) than a fixed length string (CHAR). You save a lot
> of db space.

In the case of InterBase/Firebird (and perhaps also others), this isn't
true. Both store character data compressed internally.

What is true, however, is that when returning the data, CHARs will have
spaces to make up the full length of the column. So a CHAR(1000) column will
always return a value with the text (eg: "Martijn Tonies") padded with 9986

> Secondly we had a recent discussion of varhcars here and the concensus was
> that varchar 255 was pretty much the economical limit - any larger and a
> blob subtype text is in order... so drop the CHAR(500) fields to BLOBs and
> make all CHAR field greater than say 4 or 5 in length to VARCHARs


With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase & Firebird
Firebird Workbench - the developer tool for Firebird
Upscene Productions

"This is an object-oriented system.
If we change anything, the users object."