开发者

SQL Queries, execution plans and "Parallelism"

开发者 https://www.devze.com 2023-01-19 05:01 出处:网络
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 joinin

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 "Paralelli开发者_Go百科sm" cases. Mostly "Distribute Streams" and "Repartition Streams". What are these?


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.

select *
    from sys.tables
    option (maxdop 1)
0

精彩评论

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

关注公众号