Running a ruby script once a week automatically

I have a SQL query that examines an entire column (right now 25,000
rows, but growing fast), it finds the top 50 most common elements in a
column. To reduce load, I want to execute this script only once a week
instead of every time the page is loaded.

What is the best way to do this? Just run a cron job that executes a
Ruby script once a week? Or does MySQL have something built in for this?

What is the best way to do this? Just run a cron job that executes a
Ruby script once a week? Or does MySQL have something built in for this?

I have the same situation with scripts, cron is a right choice.

jotto [email protected] wrote:

I have a SQL query that examines an entire column (right now 25,000
rows, but growing fast), it finds the top 50 most common elements in a
column. To reduce load, I want to execute this script only once a week
instead of every time the page is loaded.

What exactly do you mean by “every time the page is loaded”? Is this
some
kind of web application? Are you using some kind of framework?

What is the best way to do this? Just run a cron job that executes a
Ruby script once a week? Or does MySQL have something built in for
this?

I don’t know MySQL - it probably has. An alternative approach is to use
cron to schedule your script and have the script write the result of
processing in a table inside your DB. The “page” can then read from
that
instead of triggering the complex process every time. HTH

Kind regards

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs