非常大的字段对MySQL数据库有负面影响? [英] Do very large fields have a negative effect on MySQL databases?

查看:304
本文介绍了非常大的字段对MySQL数据库有负面影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Django构建一个网站,并且希望托管可能达到几KB的用户生物样式页面。这些字段不一定需要被搜索,但确实需要在查找用户名时提供。



它会对将数据存储在db?

解决方案

如果我在DB中使用静态文本文件,我的服务器会运行得更好吗?问题是在MySql中存储您的数据(vs外部文本文件):将数据存储在数据库中绝对是最好的方法。



BLOB一个通用术语 - 在这种情况下Oleksi绝对正确(我标记他+1,不是!)。



但是你想要的具体的MySql类型确实是TEXT: / p>



作为TEXT存储在mySql数据库中将有很多好处(包括但不限于性能)。



将文本存储在外部文件中没有优势。



PS:



我有一个旧的PHP / MySQL网络应用程序,使用一个非常旧的版本,早于MySQL中的自由文本搜索。如果我不能将它移植到一个新的服务器,我正在认真考虑保存所有的笔记数据在外部文件,只是这样我可以运行一个索引器像Lucene对文本。但这是规则的例外。存储在数据库中几乎肯定是你的情况下的最佳选择。 IMHO ...


I'm currently building a website with Django and want to host user bio style pages which may be up to a several KB. These fields don't necessarily need to be searched but do need to be served when the username is looked up.

Will it have a negative effect to store this data in the db? Would my server run better if I were to use static text files with a link in the DB?

解决方案

The basic answer to your question is "storing your data in MySql" (vs an external text file): storing the data in the database is definitely the best approach here.

"BLOB" can be a generic term - in which case Oleksi is absolutely correct (I marked him +1, not down!).

But the specific MySql type you want is indeed TEXT:

Storing as TEXT in your mySql database will have many benefits (including, but not limited to, "performance").

There's no advantage to storing the text in external files that I can think of.

PS:

I have a legacy PHP/MySQL web app that uses a very old version that predates free-text searching in MySQL. If I can't port it to a new server, I'm seriously considering saving all the "notes" data in external files, just so I can run a indexer like "Lucene" against the text. But that's the exception to the rule. Storing in the database is almost certainly the best choice in your case. IMHO...

这篇关于非常大的字段对MySQL数据库有负面影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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