[英]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链接(想想twitter),或很长的例如。 html blog post (think wordpress). html博客文章(认为wordpress)。
I am thinking if I use varchar(4000)
, it maybe too short for a html formated blog entry? 我在考虑是否使用varchar(4000)
,对于html格式的博客条目来说可能太短了吗? but if I use text
, it will take up more space and is less efficient? 但是,如果我使用text
,它将占用更多空间并且效率更低?
i am still condering using MySQL (if PHP 5.3/Zend Framework) or MSSQL (if ASP.NET MVC 2) 我仍然在考虑使用MySQL(如果使用PHP 5.3 / Zend Framework)或MSSQL(如果使用ASP.NET MVC 2)
If you are using Micrsoft SQL server 2008 you can use varchar(max). 如果使用的是Micrsoft SQL Server 2008,则可以使用varchar(max)。 Edit: Text is also available but isn't searchable without text indexing.. 编辑:文本也可用,但没有文本索引就无法搜索。
MySQL also has a Text
data type for storing an arbitrarily large amount of text. MySQL还具有Text
数据类型,用于存储任意数量的文本。 You can find more here: The BLOB and TEXT Types 您可以在此处找到更多信息: BLOB和TEXT类型
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.