Questions about MongoDB Usage Scenarios

  mongodb, question

At present, the database of the website is MYSQL, which stores a lot of song information records.

I wonder if it would be faster to query songs from MongoDB.

In the future, when adding, deleting and writing song information, it should be synchronized with MongoDB, right? NOSQL experience, please give directions, thank you.

There is not only one solution to many problems, which means that you can use either this technology or that technology. The purpose of learning is whatever you want, but in real production environment, it is strongly recommended to simplify your complexity and solve the problem in the simplest and most familiar way. Think about whether it is really necessary to use 2 databases to solve the same problem.

I wonder if it would be faster to query songs from MongoDB.

Maybe, maybe not. It depends on how much data you have, whether MongoDB’s data model design is reasonable, and how much hardware resources you plan to invest in it. NoSQL is more focused on horizontal expansion, that is to say, it can still keep the query speed at a certain level under the condition of increasing data volume. Personal experience, if there are tens of millions, hundreds of millions of data, MongoDB may really give full play to its advantages. Before the data reaches this magnitude, I don’t think it is necessary to introduce an additional database if only considering the speed. Compared with the complexity it brings to you, it can only be said that the cost performance is not high.

In the future, when adding, deleting and writing song information, it should be synchronized with MongoDB, right?

The problem of data synchronization depends on how high your requirements for “consistency” are. In case of strong consistency, this is a distributed transaction. I’m afraid it’s not good for performance and goes against your original intention to speed up. If final consistency is considered, look at various MySQL to MongoDB ETL tools, such as Pentaho. Of course, it is also possible to implement it by code, but it is not easy to consider all kinds of fault tolerance problems.