gpt4 book ai didi

mysql - 用于分类应用程序的 Mongodb 与(Mysql 或 Sql Server)

转载 作者:行者123 更新时间:2023-11-29 11:49:27 24 4
gpt4 key购买 nike

我们有一个分类网站。我读了一些东西,但仍然没有充分的理由在这些之间进行选择。

我的要求只是创建用户、列出并管理这些用户。这些是付费列表,因此会有货币交易。

根据我的研究 ( https://www.mongodb.com/compare/mongodb-mysql ),我发现 mongo db 比其他选项具有优势,除了复杂的事务之外。在这种情况下,什么是复杂的交易?有具体例子吗?

在选择之前我应该​​考虑哪些因素。我有使用 My SQL 和 Entity Framework 的经验,所以它现在对我更有吸引力,但是与 mongo 相比,这些真的不利于扩展吗?

除了这些选择之外,请随意建议任何其他良好的性能选项。

最佳答案

mongoDB 和 MySQL 或 SQL Server 之间存在巨大差异。MongoDB 是一个 NoSQL 数据库,这意味着它是无模式的,并且不遵循 RDBMS 的 CODD 规则,而 MySQL/SQL Server 是关系数据库。

每个都适用于不同的用例。根据mongoDB doc

Why use MongoDB instead of MySQL?
Organizations of all sizes are adopting MongoDB because it enables them to build applications faster, handle highly diverse data types, and manage applications more efficiently at scale.

Development is simplified as MongoDB documents map naturally to modern, object-oriented programming languages. Using MongoDB removes the complex object-relational mapping (ORM) layer that translates objects in code to relational tables.

MongoDB’s flexible data model also means that your database schema can evolve with business requirements. For example, the ALTER TABLE command required to add a single, new field to Craiglist’s MySQL database would take months to execute. The Craigslist team migrated to MongoDB because it can accommodate changes to the data model without such costly schema migrations.

MongoDB can also be scaled within and across multiple distributed data centers, providing new levels of availability and scalability previously unachievable with relational databases like MySQL. As your deployments grow in terms of data volume and throughput, MongoDB scales easily with no downtime, and without changing your application. In contrast, to achieve scale with MySQL often requires significant, custom engineering work.

What are common use cases for MongoDB? MongoDB is a general purpose database that is used for a variety of use cases. The most common use cases for MongoDB include Single View, Internet of Things, Mobile, Real-Time Analytics, Personalization, Catalog, and Content Management.

When would MySQL be a better fit? While most modern applications require a flexible, scalable system like MongoDB, there are use cases for which a relational database like MySQL would be better suited. Applications that require complex, multi-row transactions (e.g., a double-entry bookkeeping system) would be good examples. MongoDB is not a drop-in replacement for legacy applications built around the relational data model and SQL.

A concrete example would be the booking engine behind a travel reservation system, which also typically involves complex transactions. While the core booking engine might run on MySQL, those parts of the app that engage with users – serving up content, integrating with social networks, managing sessions – would be better placed in MongoDB

由于 MongoDB 中没有 join 的概念,所以如果你想存储数据,要么你必须创建一个 hack 将数据存储在两个表中(尽管在 MongoDB 中 join 的成本很高),要么你必须存储数据作为单个文档,会使您的文档过于复杂。在这些情况下 MySQL 具有优势。

关于mysql - 用于分类应用程序的 Mongodb 与(Mysql 或 Sql Server),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34383190/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com