Best way to run a periodic query in MySQL
In my Rails application I have a separate process (BackgroundRb) to delete all transaction开发者_开发百科s which are not successful and it must be run after every five minutes.
But in BackgroundRb, it runs a database check after every second though my query executes periodically at the specified time(after 5 minutes).
So my question is what is the best approach for this kind of scenario?
Should I use a Stored procedure in which the query is executed inside a infinite loop, not giving burden on Rails application (since BackgroundRb is accessing database at every second) or should I use a different application like Wokling to stop such frequent database access as BackgroundRb does?
I'd recommend a separate script run by cron. Cron is present on every hosting.
精彩评论