On May 10, 4:36 pm, Jian Lin <[email protected]> wrote:
> Frederick Cheung wrote:
> > On May 10, 10:41 am, Jian Lin <[email protected]>
> > wrote:
> >> it actually force write to the physical disc?
> > It's never that simple (and yes under the appropriate circumstances
> > the drive is supposed to flush to the actual disk). For example
> > there's a constant amount of overhead with each query: network latency
> > etc. not a huge amount (probably less than a millisecond), but
> > multiply that by 34000 and it will add up. If you really need to
> > manipulate this much data you'd be well advised to do the inserts in
> > bulk.
>
> so how to do inserts in bulk? by using
>
> Phrase.connection.execute("insert into phrases(s,frequency,length)
> values('#{phrase}',#{frequencies[phrase]},#{lengths[phrase]})")
>
basically. you can insert more than one tuple like that (although
perhaps not with all databases)
> ? or by ar-extensions? can ActiveRecord have a mode for saving without
> being in a transaction, or can ActiveRecord has some standard method of
> doing bulk inserts?
ar-extensions provides bulk inserts if the db supports it.
Fred
>
> --
> Posted viahttp://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
-~----------~----~----~----~------~----~------~--~---