数据库选择
mg 适合内容不重要且读写要求频繁还需要持久化,如评论信息就能直接 mg 了。redis 主要还是中间缓存数据,提高 io 读写速度,像点赞,查询列表,详情页,浏览数,关注列表粉丝这些粹片化的信息
mg适合存储你自己都不关心的数据。。
Applications for MySQL and MongoDB
MySQL is well-suited for the following use cases:
- High-traffic sites, such as e-commerce or social sites
- Sites that require high security protocols, such as government-based and compliance-heavy industries
MongoDB is optimal for the following use cases:
- Legacy businesses that seek to upgrade big data
- Content management systems (CMS)
- High-query sites and applications, such as analytics apps
在 MySQL 中,在将数据与行和列一起存储之前,必须明确定义列和表。在这里,每个字段都包含一行和一列。这意味着数据存储不会像 MongoDB 那样为您提供很大的灵活性。这也意味着更慢的部署和开发过程。
但是,如果您的应用程序有一个固定的模式,MySQL 是最好的。它将提供更好的数据一致性,而无需一次又一次地更改设计或浪费时间。但同样,如果您有不断变化的需求,MongoDB 可能是您更好的选择。
获胜者:显然,MongoDB 提供了更多的模式灵活性。
如果你的数据结构在前期会不断的发生变化 可以使用mongodb
参考