We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

multi insert transactions

andieje
andieje asked
on
Medium Priority
402 Views
Last Modified: 2012-06-22
Hello

I am using a multi insert transaction to enter data in batches it there any benefit i changing this:

START TRANSACTION;
NSERT table (field1,field2) VALUES (data1,data2);
INSERT table (field1,field2) VALUES (data3,data4);
INSERT table (field1,field2) VALUES (data5,data6);
INSERT table (field1,field2) VALUES (data7,data8);
INSERT table (field1,field2) VALUES (data9,data10);
COMMIT;

to this


START TRANSACTION;
INSERT table (field1,field2) VALUES
(data1,data2), (data3,data4), (data5,data6), (data7,data8), (data9,data10);
COMMIT;


The latter method is generally quicker without a transcation but is it still quicker whilst using a transaction?

MAny thanks
Comment
Watch Question

CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
thank-you - I'm sure you recognised your advice to me in this question from a previous question :)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.