Why is there a HUGE performance difference between temp table and subselect

后端 未结 2 500
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 13:38

This is a question about SQL Server 2008 R2

I\'m not a DBA, by far. I\'m a java developer, who has to write SQL from time to time. (mostly embedded in code). I want

2条回答
  •  不思量自难忘°
    2020-12-07 14:26

    There are lot of things to tackle here, indexes, execution plans, etc. Testing and comparing results is the way to go.

    You could take a look to the usual suspects, indexes. Take a look into the execution plan and compare them. Make sure the WHERE clause is using the correct ones. Ensure you are using the indexes on your JOINs.

    These answers sure will help you a lot.

    • Performance: Subquery or Joining
    • Is there a speed difference between CTE , SubQuery and Temp tables?

提交回复
热议问题