running a ruby script once a week automatically

J

jotto

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.
 
R

Robert Klemme

jotto said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top