Skip navigation links

MySQL Forums :: Performance :: bulk insert


Advanced Search

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.

Options: ReplyQuote


Subject Views Written By Posted
bulk insert 9698 tomaz bracic 02/15/2008 08:14AM
Re: bulk insert 5630 Ollie L 02/20/2008 12:06PM
Re: bulk insert 3379 Erin ONeill 02/20/2008 02:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.