Why is there a HUGE performance difference between temp table and subselect
问题 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 to know if I did something wrong here, and if so, what I can do to avoid it to happen again. Q1: SELECT something FROM (SELECT * FROM T1 WHERE condition1) JOIN ... Q1 features 14 joins Q2 is the same as Q1, with one exception. (SELECT * FROM T1 WHERE condition1) is executed before, and stored in a temp table. This is not a