...

View Full Version : what to use? VARCHAR or TEXT?



student
03-28-2007, 04:14 AM
hello,
I have a doubt.
I have orizinally declared the fields in my table like this:

...
title varchar(200) default NULL,
description text,
keywords text
details text
....

But I have limited 'description' and 'keywords' to 300 characters each and 'details' to 1000 characters in my php script.

Now, shall I change it like this:

...
title varchar(200),
description varchar(300),
keywords varchar(300),
details varchar(1000),
....

I have a fulltext index on these fields and I wish to optimize my table for good performance.

please inform me how should I declare my fields.
thank you.

maghiel
03-28-2007, 10:16 AM
varchar can only be 255 characters long.



CHAR( ) A fixed section from 0 to 255 characters long.
VARCHAR( ) A variable section from 0 to 255 characters long.
TINYTEXT A string with a maximum length of 255 characters.
TEXT A string with a maximum length of 65535 characters.
BLOB A string with a maximum length of 65535 characters.
MEDIUMTEXT A string with a maximum length of 16777215 characters.
MEDIUMBLOB A string with a maximum length of 16777215 characters.
LONGTEXT A string with a maximum length of 4294967295 characters.
LONGBLOB A string with a maximum length of 4294967295 characters.[

rafiki
03-28-2007, 02:28 PM
http://www.codingforums.com/showpost.php?p=540233&postcount=6
this helps me choose on what field type to set, hope it does the same for you

student
03-28-2007, 02:59 PM
Thank you maghiel and rafiki,
I indeed neglected the very basic concepts.
Thanks for the information.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum