BatchedSqlFuThis is vendor specific to MySQL or any RDBMS that supports the syntax :
INSERT INTO (col1, col2) VALUES ('val1', 'val2'), ('val3', 'val4'), ('val5', 'val6').
What it does is it
... [More]
overrides the insert method of the connection adapter for the duration of the block and flushes inserts every after 100 inserts are by the value you specify.
ExampleLine.insert_by_batch do
Line.create(:text => 'Hello')
Line.create(:text => 'World')
end
all statements will be the executed in one SQL.
Installruby script/plugin install http://batched-sql-fu.googlecode.com/svn/trunk/batched_sql_fu
CaveatsYou might not receive the expected result from Line.create or Line.save since the statements are executed later.
This plugin is experimental. Use it at your own risk!
Copyright (c) 2008 David, released under the MIT license [Less]