1024programmer Mongodb The difference between MongoDB and MySQL in use

The difference between MongoDB and MySQL in use

Two databases that have developed very well in different fields, MongoDB (NoSQL) and MYSQL (relational), record their differences and the environments they are used in.

MongoDB sacrifices space in exchange for strong scalability and a certain aspect of great speed improvement. .
simply put.
Relationship + transaction of relational database. Nosql headed by mongodb does not have
It takes about 2 hours to insert 1 million data into a relational database, taking mysql as an example, and it takes 3 minutes to insert 1 million data into mongodb. .
Insert 100w data, mongodb increased by 5G. The disk space of the mysql storage database has not increased significantly, not even 500M.
Query speed, mongodb is very fast.
But if you deal with the relationship, you will kneel down.
For a simple example, a financial system is designed to delete a user (user foreign key to the user’s consumption record buy table). All the user’s buy records are deleted at the database layer at one time without any errors.
But mongodb can’t do it, it doesn’t have foreign keys. We can only delete the user first, and then find out all the records belonging to this user in the buy and delete them, and if there is a problem in the process and it is terminated, resulting in the deletion of the user, the consumption records of the deleted user are still there, and the system will be disordered up. .

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/the-difference-between-mongodb-and-mysql-in-use/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索