What's the fastest way to bulk insert a lot of data in SQL Server (C# client)

前端 未结 8 1212
予麋鹿
予麋鹿 2020-11-28 22:39

I am hitting some performance bottlenecks with my C# client inserting bulk data into a SQL Server 2005 database and I\'m looking for ways in which to speed up the process.

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 23:36

    Have you tried using transactions?

    From what you describe, having the server committing 100% of the time to disk, it seems you are sending each row of data in an atomic SQL sentence thus forcing the server to commit (write to disk) every single row.

    If you used transactions instead, the server would only commit once at the end of the transaction.

    For further help: What method are you using for inserting data to the server? Updating a DataTable using a DataAdapter, or executing each sentence using a string?

提交回复
热议问题