简体   繁体   English

MYSQL BLOB vs TEXT字段与搜索查询

[英]MYSQL BLOB vs TEXT Field with search query

I am designing a mysql database and I need your help, please. 我正在设计一个mysql数据库,需要我的帮助。 I have a table with large texts (from internet, word, emails...) and I will do search in these texts. 我的桌子上有大文本(来自互联网,单词,电子邮件等),我会在这些文本中进行搜索。 For example, I need to know all the texts that contains the world 'Fox'. 例如,我需要知道包含世界“ Fox”的所有文本。 Most of the access of the table will be for reading, but sometimes I will need updates. 对该表的大部分访问将用于读取,但有时我需要更新。 And because of these I have 2 questions: 由于这些原因,我有两个问题:

1) Which one is better for this situation : BLOB or TEXT? 1)对于这种情况,哪种更好:BLOB或TEXT? 2) Is it better to build 2 separate tables with one containing the texts that will never be updated (those from internet, for example) and the other with the texts that the user will update? 2)最好用两个单独的表构建一个表,其中一个包含永远不会更新的文本(例如,那些来自Internet的文本),另一个包含用户将更新的文本? And if the answer to this question is YES, which one i shall use in each table? 如果对这个问题的回答是“是”,那么我将在每个表中使用哪个?

Thank you very much ! 非常感谢你 !

As for BLOB vs TEXT , it depends on the contents you expect. 至于BLOB vs TEXT ,则取决于您期望的内容。 I would think TEXT CHARACTER SET utf8mb4 would be appropriate for today. 我认为TEXT CHARACTER SET utf8mb4适合今天。

As for the other questions; 至于其他问题; it sounds like "premature optimization". 听起来像“过早的优化”。 Do whatever is simpler for now. 现在就做些更简单的事情。 But plan to revisit performance and other issues after you have enough data to test with. 但是,在您有足够的数据可用于测试之后,请计划重新考虑性能和其他问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM