Christophe Barbe wrote:
>I am looking about experienced pros and cons on the use of VARCHAR. My
>understanding is that, except if you know that each time the text will
>have the same length, VARCHAR is better. This seems a bit too perfect to
You do not have to use all the chars ... if you have a field that is
CHAR(100), it will always use 100 bytes, but you can insert a 12 byte
value (or none) into it anyway. If you have lots of disk space, just
use CHAR and ignore VARCHAR if you want. If you want to conserve disk
space, VARCHAR will save you some (maybe lots).
>Also I am wondering about the tradeof between using a separate table for
>rare comments (ie. most of the time empty) and the use of a VARCHAR
>which use only one byte to store an empty comment.
It depends on your queries; if you don't ask for the large blob often
then you'll get better performance with seperate tables. Some of the
gurus around here might have additional comments ...
PS, SQL QUERYs are fun ... (anti-spam anti-filter)
Michael T. Babcock
C.T.O., FibreSpeed Ltd.