In MySQL you can insert multiple rows like this:
INSERT INTO \'tablename\' (\'column1\', \'column2\') VALUES
(\'data1\', \'data2\'),
(\'data1\', \'da
I wrote some ruby code to generate a single 500 element multi-row insert from a series of insert statements which was considerably faster than running the individual inserts. Then I tried simply wrapping the multiple inserts into a single transaction and found that I could get the same kind of speed up with considerably less code.
BEGIN TRANSACTION;
INSERT INTO table VALUES (1,1,1,1);
INSERT INTO table VALUES (2,2,2,2);
...
COMMIT;