nash
nash

Reputation: 725

Best way to run a periodic query in MySQL

In my Rails application I have a separate process (BackgroundRb) to delete all transactions 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?

Upvotes: 1

Views: 866

Answers (1)

Victor Sergienko
Victor Sergienko

Reputation: 13485

I'd recommend a separate script run by cron. Cron is present on every hosting.

Upvotes: 1

Related Questions