Clustered indexes on non-identity columns to speed up bulk inserts?

后端 未结 6 580
名媛妹妹
名媛妹妹 2020-12-10 16:16

My two questions are:

  • Can I use clustered indexes to speed up bulk inserts in big tables?
  • Can I then still efficiently use foreign key relationships i
6条回答
  •  渐次进展
    2020-12-10 16:38

    Have a look at the System.Data.SqlClient.SqlBulkCopy API. Given your requirements to write signficant numbers of rows in and out of the database, it might be what you need?

    Bulk copy streams the data into the table in a single operation then performs the index check once. I use it to copy 500,000 rows in and out of a database table and it's performance is an order of magnitude better than any other technique I've tried, assuming that your application can be structured to take use of the API?

提交回复
热议问题