我应该为列使用哪种数据类型?[MySQL] [英] What datatype should I use for my column? [MySQL]

查看:85
本文介绍了我应该为列使用哪种数据类型?[MySQL]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在工作一个内容管理系统.我将有一个列来保存用户内容(HTML)的正文,但我不太确定要使用哪种列类型.我不想随意指定最大长度,但是我不知道使用LONGTEXT或BLOB字段是否过大.

I am working on a content management system at work. I will have a column to hold the body of our users' content (HTML) and I'm not too sure what column type to use. I don't want to arbitrarily assign a maximum length but I don't know if using a LONGTEXT or BLOB field is overkill.

也许有人可以给我一些提示或针对这类事情向我推荐某种最佳实践"文章的方向?:)

Maybe someone could give me a tip or point me in the direction of some sort of "best practices" article for these types of things? :)

感谢您的帮助

推荐答案

您应该GZip和Base64对HTML进行编码,然后将其存储在文本"列中.

You should GZip and Base64 encode the HTML then store it in a Text column.

这篇关于我应该为列使用哪种数据类型?[MySQL]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆