在 SQL 服务器查询中关闭 NOCOUNT 的优缺点是什么? [英] What are the advantages and disadvantages of turning NOCOUNT off in SQL server queries?

查看:28
本文介绍了在 SQL 服务器查询中关闭 NOCOUNT 的优缺点是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SQL 服务器查询中关闭 NOCOUNT 有什么优点和缺点?

What are the advantages and disadvantages of turning NOCOUNT off in SQL server queries? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

推荐答案

来自 SQL BOL:

From SQL BOL:

SET NOCOUNT ON 阻止发送DONE_IN_PROC 消息给客户端对于存储中的每个语句程序.对于存储过程包含几个不包含的语句返回大量实际数据,设置SETNOCOUNT 到 ON 可以提供一个显着的性能提升,因为网络流量大大减少.

SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. For stored procedures that contain several statements that do not return much actual data, setting SET NOCOUNT to ON can provide a significant performance boost, because network traffic is greatly reduced.

请参阅 http://msdn.microsoft.com/en-us/library/ms189837.aspx 了解更多详情.
此外,SQLServerCentral 上的这篇文章在这个主题上也很棒:
NOCOUNT 的性能影响

See http://msdn.microsoft.com/en-us/library/ms189837.aspx for more details.
Also, this article on SQLServerCentral is great on this subject:
Performance Effects of NOCOUNT

这篇关于在 SQL 服务器查询中关闭 NOCOUNT 的优缺点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆