Hi, My script that uses ActiveRecord to retreive about 1mil of records from database runs out of memory in about 10 second and crashes. Is there any way to significantly reduce memory footprint? The line in question is a simple object.find(:all, :conditions => "..........") Help would be much appreciated. Thanks Petr -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jan-16 11:02 UTC
Re: ActiveRecord: reducing memory footprint with find
On 16 Jan 2008, at 10:42, Petr Janda wrote:> > Hi, > My script that uses ActiveRecord to retreive about 1mil of records > from > database runs out of memory in about 10 second and crashes. Is there > any > way to significantly reduce memory footprint? The line in question > is a > simple object.find(:all, :conditions => "..........") >Well using :select to only fetch needed columns would help. I would expect that dropping down to the level of ActiveRecord::Base.connection.select_all would save you something as well, but obviously you''re not dealing with ActiveRecord objects anymore. Fred> Help would be much appreciated. > Thanks > Petr > -- > 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?hl=en -~----------~----~----~----~------~----~------~--~---