Page 1 of 1

Field type choice

Posted: Tue Aug 07, 2007 2:36 pm
by icesolid
I was wondering what is a better choice for field types in a MySQL database.

I use VARCHAR for most fields. However, some fields may be up to 10000 to 20000 characters and for those fields I use LONGTEXT. Is TEXT sufficient for fields up to 10000 to 15000 characters or should I stick with LONGTEXT?

Posted: Tue Aug 07, 2007 2:41 pm
by feyd
Have you looked at the storage capacity listing in the MySQL manual?

http://dev.mysql.com/doc/refman/5.0/en/ ... rview.html

Posted: Tue Aug 07, 2007 2:55 pm
by icesolid
From http://dev.mysql.com/doc/refman/5.0/en/ ... rview.html
TEXT[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]

A TEXT column with a maximum length of 65,535 (216 – 1) characters.

An optional length M can be given for this type. If this is done, MySQL creates the column as the smallest TEXT type large enough to hold values M characters long.
So TEXT type has a maximum of 65,535 characters?