> -----Original Message-----
> From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, January 10, 2003 11:04 AM
> To: Matt Schroebel
> Cc: Simon Dedeyne; [EMAIL PROTECTED]
> Subject: Re: [PHP] Mysql/php database performance question
> 

> 
> char of greater size than 3 is converted to varchar anyways

Are you sure?  I've been reading up on this stuff over the last few
days, and my understanding is that char is stored fixed width with
trailing spaces padding the string to the length specified in the
schema, whereas varchar is stored is strlen(rtrim(column))+1.  So a
column char(45) will always take 45 bytes of space, while varchar(45)
will vary from 1 to 46 bytes of space.

The first way makes locating a row in the db fast (as long as all
columns are fixed width [No blob, text, or varchar columns]) since it's
simple math, whereas the latter way saves space but makes MYSQLs finding
a row a little harder (since the offset varies) and thus a bit slower.
I have always been using varchar and have been considering changing to
char.

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html
#CHAR

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to