Tero_T
1
There are afaik several ways to do multi-record operations on DB.
Mileage of course varies depending on DMBS.
Is AR capable of folding multi-record modifications (inserts, deletes
or updates) to single SQL statement? Interface I had in mid was
something like
with_lazy_write do
massive_data.each { |item| MyModel.create_from(item) }
end
which (depending on DB adapter) could boil down to something like
these
INSERT INTO my_models SELECT … UNION SELECT … UNION SELECT …
INSERT INTO my_models VALUES (…), (…), (…), (…), (…), …
–
Tero
Tero_T
2
On 7 Aug 2008, at 12:46, Tero T. wrote:
There are afaik several ways to do multi-record operations on DB.
Mileage of course varies depending on DMBS.
Is AR capable of folding multi-record modifications (inserts, deletes
or updates) to single SQL statement? Interface I had in mid was
something like
Not that I know of.
Fred
Tero_T
3
Am I missing something or am I just the only one who needs to optimize
multi-record modifications? 
Tero_T
4