Multiple rows with a single INSERT in SQLServer 2008
        Posted  
        
            by Todd
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Todd
        
        
        
        Published on 2010-04-12T16:35:12Z
        Indexed on 
            2010/04/12
            17:13 UTC
        
        
        Read the original article
        Hit count: 500
        
I am testing the speed of inserting multiple rows with a single INSERT statement.
For example: INSERT INTO [MyTable] VALUES (5, 'dog'), (6, 'cat'), (3, 'fish)
This is very fast until I pass 50 rows on a single statement, then the speed drops significantly.
Inserting 10000 rows with batches of 50 take 0.9 seconds. Inserting 10000 rows with batches of 51 take 5.7 seconds.
My question has two parts:
- Why is there such a hard performance drop at 50?
 - Can I rely on this behavior and code my application to never send batches larger than 50?
 
My tests were done in c++ and ADO.
© Stack Overflow or respective owner