So I decided to dig a little deeper into the plan, and noticed that there was a Parallelism item for just about every SQL. Even stranger, I found that if I removed a particular column from the select list (that happened to be a DECIMAL 20,9) that the parallelism went and the SQL flew.
Now I'm not sure if there is any more work required when selecting a DECIMAL field, however it was definitely related. Remove any other field and the parallelism (and the performance) didn't change.
Finally settled on stopping SQL from pursueing parallelism by adding the following after the end of the SELECT statement :
OPTION ( MAXDOP 1 )
This forces the SQL to be run on one processor, and lo the performance is now back to less that half a second.
Not maybe an ideal solution as I'm telling SQL that it is wrong. However, looking at the plan, all the estimated costs are well off so I can only assume that this is some weird set of circumstances.
No comments:
Post a Comment