> You pretty much answered your own question. A char will always use the
> same amount of space (the max size), regardless of how little data you
> put in it. A varchar will only use enough space to store the data, so
> the amount of space used for each record will be different. You can
> also specify a max size for varchar. Text is like varchar, but with a
> "fixed" max size of 65,000 characters.

That's actually not entirely true :-)

Yes, it holds true for MySQL because of it's rather crappy implementation
on data storage in the current engines.

There's a -logical- difference between CHAR and VARCHAR in which
CHAR always adds padded spaces and VARCHAR strips these.

However, as I said, this is a -logical- difference. The space that is needed
for storage is a physical issue which is implementation defined. Another
storage engine can store CHAR and VARCHAR the same if it likes to do
that and so the space requirements can be (more or less) the same.

To answer this question truely, you need to know what storage engine is
used AND you need to know how the storage is implemented.

> > char limit 255 character fixed length
> > varchar limit 65,000 character variable length
> > text limit 65,000 character variable length.


Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


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

Reply via email to