On Aug 3, 1:24 pm, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
> Michaël wrote:
> > Hi,
>
> > Is it possible, when using a find method with a Model, to record the
> > MySQL thread ID for the subsequent database query? Does ActiveRecord
> > expose this?
>
> Why on earth would you need this?  What are you trying to achieve?
>
>
>
> > Many thanks,
> > Micha l

Because the application I'm maintaining uses Model find() methods to
run large queries on the database to produce reports. These queries
can take upwards of 10 minutes due to some complex table joins. While
I'm altering the way these are working so they're not taking a large
amount of time, I need an interim solution where I monitor the
database for any of these queries that are taking more than a set
maximum time, killing the thread of those queries that are going over
the threshold and recording which query was killed so it can be re-run
at a quieter time. It would be really useful if, when one of these
large finds is run, that I could record the thread ID it creates so if
I need to kill a thread, I can match it back up to the originating
find() call.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to