Forum: Ruby on Rails Bulk Inserts. Fast way to insert 1000s records?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Chris R. (Guest)
on 2006-05-09 14:01

This code loops through my results and saves them :


There are potentially thousands of results.  This takes ages to
Is there a quicker way to do this?

Any help is greately appreciated
Jack C. (Guest)
on 2006-05-09 17:05
(Received via mailing list)
Chris R. wrote:

>Any help is greately appreciated
Wrapping this in a transaction block should offer some improvement
provided your db supports transactions.

Jack C.
Richard W. (Guest)
on 2006-05-09 17:33
(Received via mailing list)
On Tuesday, May 09, 2006, at 12:01 PM, Chris R. wrote:
>Any help is greately appreciated
>Posted via
>Rails mailing list

At the extreme - - you can write your data to a temporary CSV file then
use the native database bulk loader (assuming there is one) to do the
This topic is locked and can not be replied to.