Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences between MongoDB and MySQL

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the difference between MongoDB and MySQL". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the difference between MongoDB and MySQL".

The difference between MongoDB and MySQL: 1, MySQL is a traditional relational database, while MongoDB is a non-relational database; 2, MySQL has different storage methods on different engines, and MongoDB storage mode is "virtual memory + persistence"; 3, MySQL uses traditional sql statements, and so on.

This article operating environment: Windows7 system, Mysql5.7.14 version, Dell G3 computer.

What is the difference between MongoDB and MySQL?

The difference between MongoDB and MySQL

Foreword:

MySQL and MongoDB are commonly used open source databases, but MySQL is a traditional relational database, MongoDB is a non-relational database, also known as document database, is a NoSQL database. Each of them has its own advantages, the key is to see where to use it. So the SQL statements we are familiar with do not apply to MongoDB, because SQL statements are the standard language for relational databases.

I. Relational database-MySQL

1. There are different storage methods on different engines.

2. The query statement uses the traditional sql statement, which has a relatively mature system and high maturity.

3. The share of open source databases is increasing, and the share of mysql pages continues to grow.

4. The disadvantage is that the efficiency will be significantly slower when dealing with massive data.

2. Non-relational database-MongoDB

Non-relational database (nosql), which belongs to document database. First explain the database of the document, that is, you can store the data of the xml, json, and bson types. These data are self-reporting and show a hierarchical tree data structure. The data structure consists of key-value (key= > value) pairs.

1. Storage mode: virtual memory + persistence.

2. Query statement: it is a unique query mode of MongoDB.

3, suitable for scenarios: event recording, content management or blog platform, etc.

4. Architectural features: high availability can be achieved through replica sets and sharding.

5. Data processing: the data is stored on the hard disk, but the data that needs to be read frequently will be loaded into memory and stored in physical memory, thus achieving high-speed reading and writing.

6. Maturity and extensiveness: emerging database, low maturity, Nosql database is the closest to relational database, one of the more perfect DB, the applicable population is growing.

III. Advantages and disadvantages of MongoDB

Advantages:

1. The performance of MongoDB in an appropriate amount of memory is very fast. It stores hot data in physical memory, which makes the reading and writing of hot data very fast.

2. The high availability of MongoDB and the high scalability of cluster architecture.

3. In the replica set, when the master database encounters problems and cannot continue to provide services, the replica set will elect a new master library to continue to provide services.

4. The data in Bson and JSon format of MongoDB are very suitable for storage and query in document format.

Disadvantages:

1. Transaction operations are not supported. MongoDB does not have its own transaction mechanism. If you need to implement the transaction mechanism in MongoDB, you need to logically implement the transaction by yourself through an additional table.

2. There is less application experience, because the rise time of NoSQL is short, the application experience is less than that of relational database.

3. MongoDB takes up too much space.

IV. Comparison

Database MongoDBMySQL database model non-relational relational storage in the format of JSON-like documents different engines have different storage methods query statements MongoDB query methods (functions similar to JavaScript) SQL statement data processing is based on memory and stores hot data in physical memory, thus achieving high-speed reading and writing different engines have their own characteristics, mature emerging databases, low maturity and high breadth of NoSQL databases Relatively perfect and open source, the number of users is growing open source database, market share is growing transactional only supports single document transaction operation, weak consistency supports transaction operation occupies space large footprint small join operation MongoDB has no joinMySQL support join thank you for your reading, these are the contents of "what's the difference between MongoDB and MySQL", after the study of this article I believe that we have a deeper understanding of the difference between MongoDB and MySQL, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report