What data type to use for variable length data (for performance)?
What data type should I use for data that can be very short, eg. html link (think twitter), or very long eg. html blog post (think wordpress).
I am thinking if I use varchar(4000)
, it maybe too short for a html formated blog entry? but if I use text
, it will take up more space and is less efficient?
[update]
i am still condering using MySQL (if PHP 5.3/Zend Framework)开发者_JS百科 or MSSQL (if ASP.NET MVC 2)
MySQL also has a Text
data type for storing an arbitrarily large amount of text. You can find more here: The BLOB and TEXT Types
If you are using Micrsoft SQL server 2008 you can use varchar(max). Edit: Text is also available but isn't searchable without text indexing..
精彩评论