port001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Aug-28 15:02 UTC
Detecting duplicate queries
Hi, I noticed in my logs that I''d be doing some duplicate queries and I''d like to implement a system to warn me of duplicates in the future. I''m fairly new to the Rails framework, so I''m not able to make an informed decision as how to best implement this. ActiveRecord Observers stood out as the most obvious candidate, yet at closer look they don''t seem able to help. I need some hooks for a per-requests basis, not per-module. I assume that using a plugin I am able to override AbstractAdapter#log? (I''ve never written a plugin). So I suppose I''m looking for the best place to insert my request start/end hooks before I go off writing code. Of course, I''d much prefer someone to point me in the direction of some code that already does all of this ;) Cheers Ian. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Hey, I noticed that I''d been causing a couple of duplicate queries in a few places, and I''d like to implement a system to warn if this happens in the future. I''m far from being a Rails expect so I''m looking for a little guidence as how best to implement this. AbstractAdapter#log looks like a good place to put one of my hooks, I''m just not sure where to put those to catch request start/end events? A prior implementation to this problem would be much better of course :) Cheers Ian --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> I noticed in my logs that I''d be doing some duplicate queries and I''d > like to implement a system to warn me of duplicates in the future. I''m > fairly new to the Rails framework, so I''m not able to make an informed > decision as how to best implement this. > > ActiveRecord Observers stood out as the most obvious candidate, yet at > closer look they don''t seem able to help. I need some hooks for a > per-requests basis, not per-module.Just to clarify what you mean by duplicate queries: I''m assuming you mean you''ve got the same query being executed per request? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---