简体   繁体   English

在NoSQL DB中存储一列?

[英]Storing one column in a NoSQL DB?

In an app I am working on, we use a MySQL database and want to store articles in a table. 在我正在开发的应用程序中,我们使用MySQL数据库并希望将文章存储在表中。 Rather than store them in a SQL DB, we were looking at just storing the key to the article in a NoSQL db. 我们不是将它们存储在SQL DB中,而是将关键存储在NoSQL数据库中。 Is this a good problem to solve using NoSQL, or should we just create another table in MySQL and store the large amounts of text there? 这是使用NoSQL解决的一个很好的问题,还是我们应该在MySQL中创建另一个表并在那里存储大量文本?

We are looking at using MongoDB to store the text. 我们正在考虑使用MongoDB来存储文本。

First thing I'd do is check how MySQL runs with the 'large amount of data'. 我要做的第一件事就是检查MySQL如何运行“大量数据”。 If you're getting acceptable performance, then there's no point trying to make the system more complicated. 如果你获得了可接受的性能,那么尝试使系统更复杂是没有意义的。

Putting the text content into a separate table in MySQL wouldn't accomplish anything. 将文本内容放入MySQL中的单独表中将无法实现任何目标。 Putting it into a separate DB might help, but I wouldn't do it unless you're sure that MySQL is a significant bottleneck, and that you can't do anything else, like optimize your queries. 将它放入一个单独的数据库可能有所帮助,但我不会这样做,除非你确定MySQL是一个重要的瓶颈,并且你不能做任何其他事情,比如优化你的查询。

MongoDB is good at storing large blob-ish fields, whether text or binary. MongoDB擅长存储大型blob-ish字段,无论是文本字段还是二进制字段。 So I think that is a good thing to do. 所以我认为这是件好事。

There is a limit on BSON objects (MongoDB "records") of 4MB. BSON对象(MongoDB“记录”)的限制为4MB。 If you text fields are larger than 4MB, you can use GridFS and then there is no limit. 如果文本字段大于4MB,则可以使用GridFS ,然后没有限制。

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

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