title: Sql insert query performance
body: <p>I want to insert n records into a single table. There may be many concurrent users and they may insert/update/select data from this table. What is better way to insert in a such table say 1000 records:</p>
  
  <ol>
  <li>Send a single sql query to a database with multiple inserts. This saves server to database calls, but (I not sure) locks the table until the insert is finished and all other queries to this table will wait.</li>
  <li>Divide 1000 records in some chunks and send them in multiple sql queries. This lets the other queries to be executed on the table, but spend time on server to database calls.</li>
  </ol>
  
  <p>Is this depends on something, or there is a single way that is always the optimal one?
  Is this depends whether transactions are used or not, while inserting data?
  Is there other better ways to perform a such insert?</p>
  
  <p>The database I use is MS SQL, but it's interesting how it works in other DB like Oracle. </p>