List:General Discussion« Previous MessageNext Message »
From:Michael T. Babcock Date:October 8 2002 3:52pm
Subject:Re: CHAR vs. VARCHAR
View as plain text  
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
>be true.
>
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.
http://www.fibrespeed.net/~mbabcock


Thread
CHAR vs. VARCHARchristophe barbe8 Oct
  • Re: CHAR vs. VARCHARMichael T. Babcock8 Oct
    • Re: CHAR vs. VARCHARChristophe Barbe8 Oct
  • Re: CHAR vs. VARCHARMichael T. Babcock8 Oct
  • Re: CHAR vs. VARCHARMichael T. Babcock8 Oct
  • Re: CHAR vs. VARCHARBrent Baisley8 Oct
    • Re: CHAR vs. VARCHARChristophe BarbĂ©8 Oct
    • Re: CHAR vs. VARCHARchristophe barbe8 Oct
Re: CHAR vs. VARCHARJan Steinman9 Oct