Dear all, I am using *async_observer plug-in*. *Scenario :-* I am having two models Listener and Webhits, in which *Listener* has_many * webhits* is the association. When I am deleting Listener It should delete all the webhits corresponding to that Listener. When the data is less every thing is fine and corresponding data(webhits) are deleting. *Problem:-* Now In My Database each Listener is holding more than 2lakhs of records. When I am trying to delete Listener I am getting ana error and Mysql is not responding. *@listener *is my Listener object In my Controller, *destroy* method I added the following line *@listener.async_send(:destroy).* because I am using *async_observer plug-in.* But Its not deleting if the listener is having more records and Mysql getting hang. Can any one suggest me how to delete the records batch wise(10,000) from my DB so that Mysql might not hangs. Thanks In advance. Thanks, Yaswanth Kakarla. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Hassan Schroeder
2012-Sep-12 14:28 UTC
Re: Re: How to delete huge records from a table(batch wise)
On Wed, Sep 12, 2012 at 2:22 AM, yaswanth k <yasshu317-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Problem:- > Now In My Database each Listener is holding more than 2lakhs of records. > When I am trying to delete Listener I am getting ana error and Mysql is not > responding.What''s the error? What''s in your Rails and MySQL logs when this is happening? What is the Rails-generated query? What does `explain` say about it? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.