Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • Would it help if I add a clustered index to the temp table? The result set should include all the rows from the temp table and so i'm not sure if the time needed to create the index is worth it. Any suggestions? Commented Jun 6, 2023 at 20:55
  • 1
    You could improve your answer by explaining what the items do, and perhaps link to a reference Commented Jun 6, 2023 at 22:33
  • Clustered index will only improve a merge join. With clustered index no need to sort data from #tmpId. But it's only 9% of your plan. And it will also increase insert time into this table. Commented Jun 7, 2023 at 6:32