The difference between MongoDB and MySQL

Source: Internet
Author: User
Tags mongodb mongodb query

Objective:

MySQL and MongoDB are common open source databases, but MySQL is a traditional relational database, MongoDB is a non-relational database, also known as a document database, is a NoSQL database. They each have their own merits, the key is to see where to use. So the SQL statements we know are not suitable for MONGODB, because SQL statements are the standard language for relational databases.

First, relational database-mysql

1. There are different storage methods on different engines.
2, the query statement is the use of traditional SQL statements, with a relatively mature system, high maturity.
3, the share of open source database is increasing, MySQL share page continues to grow.
4, the drawback is that in the massive data processing time efficiency will be significantly slower.

Second, non-relational database-mongodb

Non-relational database (NoSQL), which belongs to the document type database. First explain the database of the document, that is, you can store XML, JSON, Bson type of data. This data is self-describing and presents a hierarchical tree-like structure. The data structure consists of a key value (Key=>value) pair.

1. Storage mode: Virtual memory + persistent.
2, query statement: is the unique MongoDB query method.
3, suitable for the scene: event record, content management or blog platform and so on.
4, architecture features: can be achieved through the replica set, as well as shards to achieve high availability.
5, Processing: Data is stored on the hard disk, but need to read frequently the data will be loaded into memory, the data stored in physical memory, so as to achieve high-speed reading and writing.
6, maturity and breadth: emerging databases, low maturity, NoSQL database closest to relational database, one of the more perfect db, the application of the population is constantly growing.

Third, MongoDB advantages and disadvantages

Advantage:
1, in the appropriate level of memory MongoDB performance is very rapid, it will be stored in the thermal data in physical memory, so that the thermal data read and write become very fast.
2, MongoDB's high availability and cluster architecture has very high scalability.
3. In a replica set, when the main library encounters a problem and cannot continue to provide services, the replica sets will elect a new primary repository to continue serving.
4, MongoDB Bson and JSON format data is very suitable for the document format storage and query.
Disadvantage:
1. Transactional operations are not supported. MongoDB itself does not have a transaction mechanism, and if it is necessary to implement the transaction mechanism in MongoDB, it is necessary to implement the transaction logically by itself through an additional table.
2, the application experience is few, because the NoSQL rise time is short, the application experience compares the relational database less.
3, MongoDB occupies too much space.

Four, contrast
Database MongoDB MySQL
Database model Non-relational Relationship Type
Storage mode stored in the format of a document of class JSON Different engines have different ways of storing
Query statements MongoDB Query method (JavaScript-like functions) SQL statements
Data processing methods Memory-based storage of thermal data in physical memory for high-speed reading and writing Different engines have their own characteristics.
Maturity level Emerging databases, low maturity High degree of maturity
Wide degree NoSQL database, more complete and open source, the number of users is growing Open source database, growing market share
Transactional Supports single-document transaction operations only, weak consistency Support transactional operations
Occupy space High occupancy space Small space footprint
Join operation MongoDB does not join MySQL support join

Above ~

The difference between MongoDB and MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.