title: Select rows not in another table
body: <pre><code>SELECT DISTINCT a.value
  FROM a LEFT JOIN b 
      ON a.value = b.value 
        AND (b.field IS NULL OR b.field != 'my_string');
  
  SELECT a.value
  FROM a
  WHERE a.value NOT IN
      (SELECT value 
       FROM b
       WHERE b.field = 'my_string');
  </code></pre>
  
  <p>From what I've read, doing a LEFT JOIN is faster.  But I've also read that DISTINCT is code smell for inefficient query.  How do I go about determining which query performs better in a worst case scenario?</p>
  
  <p>EDIT: sorry, id is not a primary key, it's just another field.  I'll replace it with value.</p>
  
  <p>EDIT2: Looks like everybody's hung up on my first query.  Let's say it looks like this instead.  Isn't the logic the same?</p>
  
  <pre><code>SELECT DISTINCT a.value
  FROM a LEFT JOIN b ON a.value = b.value 
  WHERE (b.field IS NULL OR b.field != 'my_string');
  </code></pre>
  
  <p>EDIT3: Sample fiddle. <a href="http://sqlfiddle.com/#!2/500ea/1" rel="nofollow">http://sqlfiddle.com/#!2/500ea/1</a></p>
  
  <p>EDIT4: Accepted answer.  <a href="http://sqlfiddle.com/#!2/500ea/8" rel="nofollow">http://sqlfiddle.com/#!2/500ea/8</a></p>