• Bob,

    What was the usage on tempdb and memory while running the various tests? That may have impacted performance.

    When the optimizer picks an execution plan it doesn't necessarily take tempdb into account. Based on that, a plan with more in-memory operations will out-perform until a threshold where spillage to tempdb arises. At this point a tempdb-based plan may be more efficient. Put another way, maybe the second two examples are optimized to take advantage of tempdb whereas the first doesn't and suffers as load increases and disk access is now required.

    I guess it depends on hardware where that threshold is reached.

    Or I may be way off. Anyone have some spare cycles to test?