Re: How to delete huge records from a table(batch wise)

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.

On Wed, Sep 12, 2012 at 2:22 AM, yaswanth k [email protected] 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 S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs