title: SQL Server putting data into temp table first before heavy join
body: <p>Is it a good idea to put data into temp table first before <strong>joining several</strong> other tables? </p>
  
  <p>For instance, let's say I have the following:</p>
  
  <ul>
  <li>tableA, 5 million rows</li>
  <li>tableB, 5 million rows</li>
  <li>tableC, 5 million rows<br>
  ...</li>
  <li>tableG</li>
  </ul>
  
  <p>The Query I want to perform may look like:</p>
  
  <pre><code>SELECT 1 FROM tableA 
  INNER JOIN tableB WITH (NOLOCK) ON tableA.col1= tableB.col1
  LEFT JOIN tableC WITH (NOLOCK) ON ...
  ...
  LEFT JOIN tableG WITH (NOLOCK) ON ...
  WHERE tableA.someCol= conditionA AND tableB.someCol= conditionB...
  </code></pre>
  
  <p>Assuming with the filter, only a small subset of tableA will be returned. Would it be a good idea to pull data from tableA first before joining other tables, so as to <strong>avoid blocking</strong> and may be <strong>increase performance</strong>?</p>
  
  <p>I tried googling but couldn't find any satisfactory answer. Thanks in advance.</p>