Have you got an index on the s column?

Colin

2009/5/9 Jian Lin <[email protected]>

>
> i am writing a test program for ActiveRecord, and it reads a document
> which is like 6000 words long.  And then i just tally up the words by
>
>    recordWord = Word.find_by_s(word);
>    if (recordWord.nil?)
>      recordWord = Word.new
>      recordWord.s = word
>    end
>    if recordWord.count.nil?
>      recordWord.count = 1
>    else
>      recordWord.count += 1
>    end
>    recordWord.save
>
> and so this part loops for 6000 times... and it takes a few minutes to
> run at least using sqlite3.  Is it normal?  I was expecting it could run
> within a couple seconds...  can MySQL speed it up a lot?
> --
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to