Jiew Meng
Jiew Meng

Reputation: 88189

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) or MSSQL (if ASP.NET MVC 2)

Upvotes: 0

Views: 781

Answers (2)

Ralf de Kleine
Ralf de Kleine

Reputation: 11734

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..

Upvotes: 1

Thomas
Thomas

Reputation: 64635

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

Upvotes: 1

Related Questions