title: SQL Server IN vs = in query(for one value)
body: <p>First of all, sorry for the vague topic name(I could not think of something better).</p>
  
  <p>An SO answer got me to thinking on whether there really is any performance impact when I chuck <code>=</code> for an IN.</p>
  
  <pre><code>select 1 id, 'abc' name into #a union 
  select 2, 'abcd' union 
  select 3, 'abcde' 
  
  select * from #a where id = 1 ------ Query 1
  select * from #a where id in (1)------ Query 2
  </code></pre>
  
  <p>I checked the query plans for both the queries and found them to me same(Maybe the example was simplistic probably that's why). </p>
  
  <p>But am I violating any performance best practice when using an <code>IN</code>? Sure there must be <em>some</em> overheads involved with that, as an <code>IN</code> can handle multiple items and even <code>SELECTS</code>. I know <code>IN</code> offers a lot more in terms of features, but for cases when there are multiple records for <code>id = 1</code>,</p>
  
  <pre><code>select * from #a where id = (SELECT id from #a where id = 1)------ Query 3
  select * from #a where id in (SELECT id from #a where id = 1)------ Query 4
  </code></pre>
  
  <p>query3 would fail while query4 would work. Thus I would want to replace <code>=</code> with an <code>IN</code> in future in my code. But I want to know of any <em>potential</em> trade-offs.</p>
  
  <p><strong>EDIT</strong> I am just interested in learning how(differently?) the SQL engine treats these statements. </p>