title: SQL Server IN vs. EXISTS Performance
body: <p>I'm curious which of the following below would be more efficient?</p>
  
  <p>I've always been a bit cautious about using <code>IN</code> because I believe SQL Server turns the result set into a big <code>IF</code> statement. For a large result set, this could result in poor performance. For small result sets, I'm not sure either is preferable. For large result sets, wouldn't <code>EXISTS</code> be more efficient?</p>
  
  <pre><code>WHERE EXISTS (SELECT * FROM Base WHERE bx.BoxID = Base.BoxID AND [Rank] = 2)
  </code></pre>
  
  <p>vs.</p>
  
  <pre><code>WHERE bx.BoxID IN (SELECT BoxID FROM Base WHERE [Rank = 2])
  </code></pre>