Skip to main content
Tweeted twitter.com/StackDBAs/status/1525128746226880513
Became Hot Network Question
edited tags
Link
Charlieface
  • 14.5k
  • 14
  • 40
edited tags
Link
mustaccio
  • 26.9k
  • 24
  • 58
  • 74
Source Link
DBK
  • 378
  • 1
  • 8

Execution plan with a lot of ComputeScalar operations

I executed the same query with and without OPTION (RECOMPILE). When I compare the 2 plans, visually the one main difference I see is that the plan without option recompile shows a lot of ComputeScalar operators and the other one doesn't have any.

Here are the two plans:

Without OPTION Recompile: https://www.brentozar.com/pastetheplan/?id=S1OcZGi85 With OPTION recompile: https://www.brentozar.com/pastetheplan/?id=ryJAfMsL5

Why does one plan use a ton of compute scalar and the other one doesn't? The query without option recompile takes nearly 4 minutes to execute. Are the compute scalar operations causing the slowness?