Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8719091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:42:27+00:00 2026-06-13T06:42:27+00:00

There is a microblogging type of application. Two main basic database stores zeroed upon

  • 0

There is a microblogging type of application. Two main basic database stores zeroed upon are:
MySQL or MongoDB.

I am planning to denormalize lot of data I.e. A vote done on a post is stored in a voting table, also a count is incremented in the main posts table. There are other actions involved with the post too (e.g. Like, vote down).

If I use MySQL, some of the data better suits as JSON than fixed schema, for faster lookups.

E.g.

POST_ID   |  activity_data

213423424 | { 'likes': {'count':213,'recent_likers' :
             ['john','jack',..fixed list of recent N users]} , 'smiles' : 
             {'count':345,'recent_smilers' :
             ['mary','jack',..fixed list of recent N users]}  }

There are other components of the application as well, where usage of JSON is being proposed.
So, to update a JSON field, the sequence is:

  1. Read the JSON in python script.

  2. Update the JSON

  3. Store the JSON back into MySQL.

It would have been single operation in MongoDB with atomic operations like $push,$inc,$pull etc. Also
document structure of MongoDB suits my data well.

My considerations while choosing the data store.

Regarding MySQL:

  1. Stable and familiar.
  2. Backup and restore is easy.
  3. Some future schema changes can be avoided using some fields as schemaless JSON.
  4. May have to use layer of memcached early.
  5. 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.

Regarding MongoDB:

  1. Better suited to store schema less data as documents.
  2. Caching might be avoided till a later stage.
  3. Sometimes the app may become write intensive, MongoDB can perform better at those points where unsafe writes are not an issue.
  4. Not sure about stability and reliability.
  5. Not sure about how easy is it to backup and restore.

Questions:

  1. Shall we chose MongoDB if half of data is schemaless, and is being stored as JSON if using MySQL?
  2. 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. Is this policy based on importance of data, and write intensiveness correct?

  3. 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. What are the best options I have with MongoDB to make it a safe bet for the application.

Stability, backup, snapshots, restoring, wider adoption I.e.database durability are the reasons pointing me
to use MySQL as RDBMS+NoSql even though a NoSQL document storage could serve my purpose better.

Please focus your views on the choice between MySQL and MongoDB considering the database design I have in mind. I know there could be better ways to plan database design with either RDBMS or MongoDB documents. But that is not the current focus of my question.

UPDATE : From MySQL 5.7 onwards, MySQL supports a rich native JSON datatype which provides data flexibility as well as rich JSON querying.

https://dev.mysql.com/doc/refman/5.7/en/json.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:42:28+00:00Added an answer on June 13, 2026 at 6:42 am

    So, to directly answer the questions…

    Shall we chose mongodb if half of data is schemaless, and is being stored as JSON if using MySQL?

    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. The power behind MongoDB is in the rich queries against schemaless storage.

    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 process must all be wrapped in a transaction. Transactions tend to be fairly straightforward, until you start denormalizing your database. Then something as simple as recording an upvote can lock tables all over your schema.

    With MongoDB, there are no transactions. But operations can almost always be structured in a way that allow for atomic updates. 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. 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.

    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. Is this policy based on importance of data, and write intensiveness correct?

    By “safe writes” I assume you mean the option to turn on an automatic “getLastError()” after every write. We have a very thin wrapper over a DBCollection that allows us fine grained control over when getLastError() is called. However, our policy is not based on how “important” data is, but rather whether the code following the query is expecting any modifications to be immediately visible in the following reads.

    Generally speaking, this is still a poor indicator, and we have instead migrated to findAndModify() for the same behavior. On the occasion where we still explicitly call getLastError() it is when the database is likely to reject a write, such as when we insert() with an _id that may be a duplicate.

    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. What are the best options I have with mongoDb to make it a safe bet for the application?

    I’m afraid I can’t speak to whether our backup/restore policy is effective as we have not had to restore yet. We’re following the MongoDB recommendations for backing up; @mark-hillick has done a great job of summarizing those. We’re using replica sets, and we have migrated MongoDB versions as well as introduced new replica members. So far we’ve had no downtime, so I’m not sure I can speak well to this point.

    Stability,backup,snapshots,restoring,wider adoption i.e.database durability are the reasons pointing me to use MySQL as RDBMS+NoSql even though a NoSQL document storage could serve my purpose better.

    So, in my experience, MongoDB offers storage of schemaless data with a set of query primitives rich enough that transactions can often be replaced by atomic operations. It’s been tough to unlearn 10+ years worth of SQL experience, but every problem I’ve encountered has been addressed by the community or 10gen directly. We have not lost data or had any downtime that I can recall.

    To put it simply, MongoDB is hands down the best data storage ecosystem I have ever used in terms of querying, maintenance, scalability, and reliability. Unless I had an application that was so clearly relational that I could not in good conscience use anything other than SQL, I would make every effort to use MongoDB.

    I don’t work for 10gen, but I’m very grateful for the folks who do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's a Rails 3.2.3 web application which doesn't use any database. But in spite
There are two intents on the receiver side which are called from the same
There are two table s : one is the master and one the detail
There is any way to set the generic type (T) of class in the
There are two kinds equals methods? public boolean equals(Bigram b) { return b.first ==
I have been using Titanium for an Android application that does some microblogging through
There are a lot of questions about full-joining in mysql(5.1.36). Of course the solution
There are two ways that I know that you can fetch results in Rails
There is <input type=text /> I need to set vertical alignment of the entered
There are two weird operators in C#: the true operator the false operator If

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.