Scenario
I have a database of over 2.5 Million Videos and Viewed daily over a million times (total). In my case I am storing all events in NoSQL (mongodb) and then process it to generate a hourly/daily report. I also calculate number of views in total of each object.
Problem
These views are stored in MongoDB and are more than 2.5 million (like Mysql), what is the best approach to update MySQL table or in other words how to update all these 2.5 million videos?
Many videos do not get any view, and many get thousands.
My current approach
Saves last update time and set the next update time in a separate collection for each video, run the cron, sort them with time, and update them one by one.
Tell me if there is any other/better solution I should go for?
Elaboration
Views are counted in mongodb and I need to update mysql table.
Each object has its document with total views and last update time in mongodb db
Cron fetches documents from mongodb w.r.t to time, loops it and update mysql table field of each video.
This way I can also restrict if video views are increased and update only those who get viewed.
P.S I am not sure If i am posting it in the right section, its more related to algorithm and logic building and is figuring out the best approach for almost big data.