mysql json mongodb_Mongodb 和 MySql native json 对比

本文对比了MongoDB和MySQL在处理JSON数据时的特点。MongoDB作为NoSQL文档型数据库,以其结构灵活和丰富的JSON查询能力著称,而MySQL自5.7版本起支持JSON存储,但更适合用于查询和展示。MongoDB适合存储不需要频繁查询且结构不固定的数据,而MySQL在处理规整数据结构时能利用索引提高效率。
摘要由CSDN通过智能技术生成

1,Mongodb 属于NoSql中的文档型数据库,支持JSON存储;Mysql从5.7开始,也支持JSON存储,两者有什么区别?

参考文章:

1.1 MySQL 特点:

– 属于关系型数据库;

擅长处理一列对应一个值;(For relational databases: use one column per value. Putting a JSON blob in a column makes it virtually impossible to query (and painfully slow when you actually find a query that works).)

创建的索引,会充分利用该列的数据类型,适用于规整的数据结构。(Relational databases take advantage of data types when indexing, and are intended to be implemented with a normalized structure.)

存储JSON的场景,是该JSON数据只是查询,或者展示使用。(If you're adding true metadata, or if your JSON is describing information that does not need to be queried and is only used for display, it may be overkill to create a separate column for all of the data points.)

如果不采用JSON存储,需要三张table表示关联关系

如下代码,需要扫描全表(table-scan)

The claim about "efficient access" is misleading. It means that after the query examines a row with a JSON document, it can extract a field without having to parse the text of the JSON syntax.But it still takes a table-scan to search for rows. In other words, the query must examine every row.

SELECT * FROM t1

WHERE JSON_EXTRACT(data,"$.series") IN ...

1.2 Mongodb 特点:

结构灵活存储(Schemaless);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值