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?
Field type choice
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Have you looked at the storage capacity listing in the MySQL manual?
http://dev.mysql.com/doc/refman/5.0/en/ ... rview.html
http://dev.mysql.com/doc/refman/5.0/en/ ... rview.html
From http://dev.mysql.com/doc/refman/5.0/en/ ... rview.html
So TEXT type has a maximum of 65,535 characters?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.