Re: bulk insert
Posted by:
Ollie L
Date: February 20, 2008 12:06PM
tomaz bracic Wrote:
-------------------------------------------------------
> Can anybody suggest me what to look or try.
Most of the time in your average insert is consumed by all kinds of connection overhead. That's why MySQL gives you the option of combining multiple inserts into one insert clause. So instead of writing
INSERT INTO tbl_name (a,b,c) VALUES(1,2,3);
INSERT INTO tbl_name (a,b,c) VALUES(4,5,6);
INSERT INTO tbl_name (a,b,c) VALUES(7,8,9);
you just write
INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
Try this out with a hundred or possibly a thousand inserts bunched into one clause and I think you'll notice a dramatic difference.