开发者

When SQL Server bcps into an empty table with an index what does it do internally?

开发者 https://www.devze.com 2023-01-17 22:27 出处:网络
If I have an empty table with an index and I do a bcp, does SQL Server (internally) drop/disa开发者_如何学运维ble the index, load the data and then re-apply/enable/build the index?No, the indexes are

If I have an empty table with an index and I do a bcp, does SQL Server (internally) drop/disa开发者_如何学运维ble the index, load the data and then re-apply/enable/build the index?


No, the indexes are maintained throughout the operation. In fact, Microsoft says you can improve bcp performance by using the -h ORDER hint to sort the data according to your clustered index. See the bcp Utility documentation for details. However, as stated here, for the fastest import possible you should take the following steps:

· The "select into/bulkcopy" database option must be set to "true".

· The target table should not have any indexes. [emphasis added]

· The target table must not be published for replication.

· Use the TABLOCK to lock the target table.


No it doesn't but it will do its best to make it as fast as possible. Also you can help a little bit too by following some basic guidelines (see http://msdn.microsoft.com/en-us/library/ms177445.aspx).

0

精彩评论

暂无评论...
验证码 换一张
取 消