C# 处理来自 SQL Server 的结果集
我的 SQL Server 上的 ASYNC_NETWORK_IO 等待时间较长,我发现这篇有趣的文章
http://blogs.msdn.com/joesack/archive/2009/01/09/troubleshooting-async-network-io-networkio.aspx
我找到的部分有趣的是:
- 识别大型结果集并与应用程序团队(或开发人员)验证如何使用它。危险信号包括应用程序查询大型结果集,但一次不能处理多于几行
如果您从 linq 查询接收到返回的结果集,那么您已经处理了它(?) 你会如何一次处理几行(?)这意味着一个sql阅读器?
您将如何查找应用程序是否导致了 ASYNC_NETWORK_IO 问题?
好奇的
I have large wait times in ASYNC_NETWORK_IO on my SQL Server and I found this interesting article
http://blogs.msdn.com/joesack/archive/2009/01/09/troubleshooting-async-network-io-networkio.aspx
the part i find interesting is:
- Identify large result sets and verify with the application team (or developers) how this is being consumed. Red flags include the application querying large results sets but not processing more than a few rows at a time
If you are receiving a result set back from a linq query then you have processed it(?)
How would you process it a few rows at a time(?) is this meaning an sql reader?
How would you go about finding if the application is causing the
ASYNC_NETWORK_IO problem?
curious
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
许多开发人员倾向于从 LINQ to SQL 查询大型结果,然后对其进行修剪,而不是依赖利用 IQueryable 的模式,这意味着您正在构建更精细的查询而不是精细的数据子集。
您可能会看到这种情况的发生:他们只需要一个子集,但他们正在编码以提取所有内容,然后他们将数据过滤出他们实际需要的内容。
IQueryable 的存储库模式将允许开发人员查询大型结果集并在多个级别上对其进行修剪,直到实际需要为止,从而确保 SQL Server 服务器的最优化使用。到那时,查询不是:
它是:
只是我的想法。
Many developers tend to query large results from LINQ to SQL and then trim them down instead of relying on a pattern that leverages IQueryable which means you are building a more refined query instead of refined data subset.
You may be seeing this happening: they need only a subset but they are coding to pull everything, then they filter the data out to what they actually need.
The repository pattern with IQueryable will ensure the most optimized use of SQL Server server by allowing the developer to query a large resultset and trim it down at many levels until it's actually needed. By that time the query isn't:
It's:
Just my thoughts.