Possible Duplicate:
Multiple INSERT statements vs. single INSERT with multiple VALUES
Im doing some performance analysis on transactions for batch processing for a blog post and I've noticed that when you use a batch insert statement it performs much slower than the equivalent individual SQL statements.
inserting 1000 rows as below takes approx 3s
INSERT TestEntities (TestDate, TestInt, TestString) VALUES
('2011-1-1', 11, 'dsxcvzdfdfdfsa'),
('2011-1-1', 11, 'dsxcvzdfdfdfsa'),
('2011-1-1', 11, 'dsxcvzdfdfdfsa')
inserting 1000 rows as below takes 130ms
INSERT TestEntities (TestDate, TestInt, TestString) VALUES ('2011-1-1', 11, 'dsxcvzdfdfdfsa')
INSERT TestEntities (TestDate, TestInt, TestString) VALUES ('2011-1-1', 11, 'dsxcvzdfdfdfsa')
INSERT TestEntities (TestDate, TestInt, TestString) VALUES ('2011-1-1', 11, 'dsxcvzdfdfdfsa')
This only appears to happen on the first time you use a batch insert on the table but its reproducible.
Also note the data im inserting is random (but the same for both queries)
EDIT:
heres my repro case with the dummy random data im using for this case: https://gist.github.com/2489133