Some of the data like main posts is critical, so it will be saved using safe writes, the counters etc will be saved using unsafe writes. At the very least, lots of other folks have run into the same problems you'll be facing, and the Mongo community tends to be fairly open and vocal about the challenges they've overcome. This usually involves some dramatic shifts from the SQL paradigms, but in my opinion they're fairly obvious once you stop trying to force objects into tables. But operations can almost always be structured in a way that allow for atomic updates. Then something as simple as recording an upvote can lock tables all over your schema. Transactions tend to be fairly straightforward, until you start denormalizing your database. The process must all be wrapped in a transaction. If I might point out a small flaw in the illustration about updating a JSON field, it's not simply a matter of getting the current value, updating the document and then pushing it back to the database. The power behind MongoDB is in the rich queries against schemaless storage. Schemaless storage is certainly a compelling reason to go with MongoDB, but as you've pointed out, it's fairly easy to store JSON in a RDBMS as well. Shall we chose mongodb if half of data is schemaless, and is being stored as JSON if using MySQL? UPDATE : From MySQL 5.7 onwards, MySQL supports a rich native JSON datatype which provides data flexibility as well as rich JSON querying. But that is not the current focus of my question. I know there could be better ways to plan database design with either RDBMS or MongoDB documents. Please focus your views on the choice between MySQL and MongoDB considering the database design I have in mind. To use MySQL as RDBMS+NoSql even though a NoSQL document storage could serve my purpose better. Stability, backup, snapshots, restoring, wider adoption I.e.database durability are the reasons pointing me What are the best options I have with MongoDB to make it a safe bet for the application. How easy is it to monitor, backup and restore MongoDB as compared to MySQL? We need to plan periodic backups ( say daily ), and restore them with ease in case of disaster. Is this policy based on importance of data, and write intensiveness correct? Some of the data like main posts is critical, so it will be saved using safe writes, the counters etc Shall we chose MongoDB if half of data is schemaless, and is being stored as JSON if using MySQL?.Not sure about how easy is it to backup and restore.Not sure about stability and reliability.Sometimes the app may become write intensive, MongoDB can perform better at those points where unsafe writes are not an issue.Caching might be avoided till a later stage.Better suited to store schema less data as documents.JSON blobs will be static in some tables like main Posts, however will be updated alot in some other tables like Post votes and likes.May have to use layer of memcached early.Some future schema changes can be avoided using some fields as schemaless JSON.My considerations while choosing the data store. Alsoĭocument structure of MongoDB suits my data well. It would have been single operation in MongoDB with atomic operations like $push, $inc, $pull etc. So, to update a JSON field, the sequence is: There are other components of the application as well, where usage of JSON is being proposed. If I use MySQL, some of the data better suits as JSON than fixed schema, for faster lookups.Ģ13423424 | There are other actions involved with the post too (e.g. A vote done on a post is stored in a voting table, also a count is incremented in the main posts table. I am planning to denormalize lot of data I.e. Two main basic database stores zeroed upon are: There is a microblogging type of application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |