SQL查询、执行计划和“并行性”
所以我(仍然)正在经历一些缓慢的遗留 SQL 视图,用于计算(有时)大量数据的一些平均值和标准差。我最终得到的是视图连接视图连接视图等。
所以我想我会检查查询的执行计划。它立即提示缺少索引,然后我实施了该索引。但它仍然慢得令人难以忍受(太慢了,以至于 VB6 应用程序查询数据时超时了;))
因此,在进一步研究执行计划后,我发现成本最高的(在我的情况下每个大约 8%)是“并行”情况。主要是“分发流”和“重新分区流”。这些是什么?
So I'm (still) going through some slow legacy sql views used to do calculate some averages and standarddeviations on a (sometimes) large set of data. What I end up with are views joining views joining views etc.
So I though I would review the execution plan for my query. And it immediately suggested a missing index, which I then implemented. But it's still unbearably slow (so slow it times out the VB6 app querying it for data ;) )
So upon studying the execution plan further, I see that what costs the most (about 8% each in my case) are "Paralellism" cases. Mostly "Distribute Streams" and "Repartition Streams". What are these?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
分发流和Repartion Streams是当SQL优化器选择使用并行查询处理。如果您怀疑这会导致查询出现问题,您可以强制 SQL Server 仅使用一个带有 MAXDOP 的 CPU 查询提示,如下图所示。
Distribute Streams and Repartion Streams are operations that occur when the SQL optimizer chooses to use Parallel Query Processing. If you suspect that this is causing an issue with your query, you can force SQL Server to only use one CPU with the MAXDOP query hint, as illustrated below.