将消息存储为 BLOB(二进制大对象)还是普通文本?

发布于 2024-08-21 03:51:24 字数 57 浏览 3 评论 0原文

在大型网站中存储消息文本的最佳方式是什么:BLOB 或表中的普通文本或其他内容?数据库:MySQL。

What is the best way to store messaging texts in large/big web sites: BLOB or ordinary text in table or something else? Database: MySQL.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

—━☆沉默づ 2024-08-28 03:51:25

在做出决定时,您需要问自己很多问题。有一篇非常详细的文章, 是 BLOB 还是不是 BLOB,这就是问题:是否将字符串存储在 BLOB、CHAR、VARCHAR 中?(已存档),其中讨论了一些需要考虑的事情。

There are a lot of questions you need to ask yourself when making that decision. There's a very detailed article, To BLOB or not to BLOB, that is the question: Whether to store string in BLOB, or CHAR, or VARCHAR? (archived), that talks about some of the things to consider.

窗影残 2024-08-28 03:51:25

如果“消息”指的是 SMS 或 IRC 等具有定义限制的内容,那么我认为 VARCHAR 是最合适的。如果您的消息确实可以是任意大小,那么 TEXT 会更好。

但我不认为 BLOB 适合任何东西,除了附件(假设你的系统有它们)。 BLOB 适用于二进制文件(例如图像、Word 文档),而不是纯文本。

If by "messages" you mean something like SMS or IRC, stuff with a defined limit then I think VARCHAR is the most appropriate. If your messages can really be any size then TEXT would be better.

But I wouldn't have thought BLOB was suitable for anything except perhaps attachments (assuming your system has them). BLOBs are meant for binary files (e.g. images, Word documents) not pure text.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文