I want to optimize these stored procedure?. Currently it takes about 47 minutes.

Yared 2015-10-01 19:03:49

There are three expensive operations happening and would like to find how to optimize performcance on below operations:
– Sort
– Table Insert
– Merge Join

Aaron Bertrand 2015-10-04 13:38:10
It seems you've captured an actual plan with Management Studio, opened it in an older version of Plan Explorer, and anonymized it. This makes it very hard to analyze the details because (a) SSMS does not include important statement-level runtime metrics, like duration, so it is impossible to tell where the time is being spent (unless we rely on estimated costs, which are not reliable) and (b) the first iteration of our anonymization feature stripped the actual statements, making it impossible to give any guidance about how to fix query text (only vague advice about troublesome plan operators). Could you please update Plan Explorer to the latest version (2.7 (, and then run the procedure from within Plan Explorer using Get Actual Plan. This will provide us with a much more useful plan (even if you still anonymize it using the new algorithm) and will allow us to make much more useful recommendations.