0

使用 INSERT INTO SELECT 时,如果 SELECT 部分自行运行,则在大约 25 秒内返回。插入我已经放手超过 8 分钟,然后取消。我该怎么做才能开始解决这个问题?不知道有没有上锁?这是一个不断进行单次选择和插入的表。此表上还有 3 个索引,我知道当新行进入时需要更新。上面的场景也仅适用于 68,000 行,而且我确实有其他插入,我需要做的将包含更多。最后,我使用的是 SQL SERVER 2008 R2。

提前致谢。

4

1 回答 1

0

Is there space for the new table? I had a project way back in SQL Server 2000. The auto-growth was killing the timing. When I pre-allocated the space before loading, the process flew.

Make sure your growth options are not 1 mb or 10 %. That will kill you also.

Also, look into instant database file initialization. If this is turned off, the SQL Server engine has to zero out the pages before giving you new space. Otherwise, it skips this step.

Good link from MSDN on this topic,

http://msdn.microsoft.com/en-us/library/gg634626.aspx

Trace Flag 1806 which disables Instant Database File Initialization. Make sure this is not set on your server.

Please post back if this does not fix your issue.

Sincerely

John The Crafty DBA www.craftydba.com

于 2013-07-18T20:10:27.633 回答