开发者

In MS SQL Server, inserting Rows into a table variable became painfully slow all the sudden

In MS SQL Server 2008, inserting Rows into a table variable became painfully slow all the sudde开发者_开发百科n. The creation of a table variable and query and insertion rows is done in a sproc and it has become terribly slow.

The query completes virtually instantly, returns a small set (10 rows of 1 column of ints), and takes upward of 50 seconds to insert into the table variable. I switched back to temp tables and that is fine, the operation happens in a few microseconds.


From table (Transact-SQL)

Queries that modify table variables do not generate parallel query execution plans. Performance can be affected when very large table variables, or table variables in complex queries, are modified. In these situations, consider using temporary tables instead.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜