Hi Hassan,

In a case like that where you know the data will always be a certain
length, CHAR is definitely better.  VARCHAR will actually waste space (1
byte) when the data is always a certain length.

And yes, if using the CHAR allows your table to have fixed-length rows,
there will be a speed improvement.

Of course, if you have other variable length columns in your table,
MySQL will be stupid and change your CHAR to VARCHAR, thinking it's
"helping" you. :-(


Matt


----- Original Message -----
From: "Hassan Shaikh"
Sent: Sunday, January 11, 2004 7:04 AM
Subject: Which one is better: CHAR or VARCHAR?


Hi,

I've a column of type VARCHAR(10) where I know the data would be 10-char
in length - always. Apart from the fact that VARCHAR saves space as
compared to CHAR, is there any performance benefit? If yes, is it
significant enough?

Thanks.


Hassan


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to