There has to be something like this... I have some tracking related SQL queries that are slow and don''t need to happen in the request cycle. Is it possible to dump them to some text file and then read them in a daemon and send them to MySQL? What would be the simplest way of implementing this? -- Posted via http://www.ruby-forum.com/.
Should note that I already have delayed_job running, but it seems a bit silly to create a job (in the database) that just executes a SQL query, even if the SQL query is running take significantly longer than creating the job. Robert Matei wrote:> There has to be something like this... I have some tracking related SQL > queries that are slow and don''t need to happen in the request cycle. Is > it possible to dump them to some text file and then read them in a > daemon and send them to MySQL? > > What would be the simplest way of implementing this?-- Posted via http://www.ruby-forum.com/.
Hi Robert Matei Can''t you use a rake task and make a cron to execute this task at a specified time or time interval ? Sijo -- Posted via http://www.ruby-forum.com/.
On Mon, Oct 19, 2009 at 7:26 PM, Robert Matei wrote:> > Should note that I already have delayed_job running, but it seems a bit > silly to create a job (in the database) that just executes a SQL query, > even if the SQL query is running take significantly longer than creating > the job.And it would be somehow less "silly" to do file IO to "dump them to some text file and then read them in a daemon and " open a DB connection to " send them to MySQL?>> What would be the simplest way of implementing this?I''d say you just identified the "simplest", since it''s already in place. YMMV :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan
I''d put them in a model and call them via cron, e.g. # in app/models: class SlowQuery < ActiveRecord::Base def self.some_query self.connection.execute "my big slow SQL here" end end cron can call: ruby script/runner "SlowQuery.some_query" On Oct 19, 10:26 pm, Robert Matei <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Should note that I already have delayed_job running, but it seems a bit > silly to create a job (in the database) that just executes a SQL query, > even if the SQL query is running take significantly longer than creating > the job. > > Robert Matei wrote: > > There has to be something like this... I have some tracking related SQL > > queries that are slow and don''t need to happen in the request cycle. Is > > it possible to dump them to some text file and then read them in a > > daemon and send them to MySQL? > > > What would be the simplest way of implementing this? > > -- > Posted viahttp://www.ruby-forum.com/.