将数据作为JSON存储在MySQL中 [英] Storing Data in MySQL as JSON

查看:529
本文介绍了将数据作为JSON存储在MySQL中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为这是一个n00b的事情。所以,我从来没有这样做过。然后我看到FriendFeed做到这一点,实际上使他们的DB规模更好,减少延迟。我很好奇,如果我应该这样做。

I thought this was a n00b thing to do. And, so, I've never done it. Then I saw that FriendFeed did this and actually made their DB scale better and decreased latency. I'm curious if I should do this. And, if so, what's the right way to do it?

基本上,什么是一个好的地方学习如何将所有的东西存储在MySQL中作为couchDB排序的数据库?将所有内容存储为JSON似乎会更容易,更快速(不建立,延迟更少)。

Basically, what's a good place to learn how to store everything in MySQL as a couchDB sort of DB? Storing everything as JSON seems like it'd be easier and quicker (not to build, less latency).

此外,它很容易编辑,删除等,

Also, is it easy to edit, delete, etc., things stored as JSON on the DB?

推荐答案

CouchDB和MySQL是两个截然不同的野兽。 JSON是在CouchDB中存储东西的本地方式。在MySQL中,最好的方法是将JSON数据作为文本存储在单个字段中。这将完全破坏将其存储在RDBMS中的目的,并且会使每个数据库事务变得非常复杂。

CouchDB and MySQL are two very different beasts. JSON is the native way to store stuff in CouchDB. In MySQL, the best you could do is store JSON data as text in a single field. This would entirely defeat the purpose of storing it in an RDBMS and would greatly complicate every database transaction.

不要。

话虽如此,FriendFeed似乎使用了一个极其自定义的模式在MySQL之上。它真的取决于你想要存储什么,几乎没有一个明确的答案,如何滥用数据库系统,所以它是有意义的。鉴于文章很古老,他们反对Mongo和Couch的主要原因是不成熟的,如果MySQL不为你编译,我将重新评估这两个。他们现在应该已经增长了很多。

Having said that, FriendFeed seemed to use an extremely custom schema on top of MySQL. It really depends on what exactly you want to store, there's hardly one definite answer on how to abuse a database system so it makes sense for you. Given that the article is very old and their main reason against Mongo and Couch was immaturity, I'd re-evaluate these two if MySQL doesn't cut it for you. They should have grown a lot by now.

这篇关于将数据作为JSON存储在MySQL中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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