Gary Doades wrote: > If you have made the change to count up words first and then *insert* > all the (word,count) records into the database in a *single* transaction > then it ought to take less than a second. I would expect that the total > number of (word,count) records is in the order or hundreds or perhaps a > thousand or so? Any decent DB ought to insert that in under a second as > a *single* transaction. > > If it is still taking minutes then you are probably not doing the above > somehow. I think in that case you need to post your code again so we can > see what it is doing now.
i was doing it like this: all_phrases = frequencies.keys Phrase.transaction do all_phrases.each do |phrase| recordPhrase = Phrase.new(:s => phrase, :frequency => frequencies[phrase], :length => lengths[phrase]) recordPhrase.save end end i am using "Phrase" instead of "Word"... but it is the same thing... all_phrases.length is about 34000 for all data... it would run for at least a minute... that's kind of weird... -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

