title: SQL: When it comes to NOT IN and NOT EQUAL TO, which is more efficient and why?
body: <p>Let's say I have a set of items:</p>
  
  <ul>
  <li>Item1</li>
  <li>Item2</li>
  <li>Item3</li>
  <li>Item4</li>
  <li>Item5</li>
  </ul>
  
  <p>A query can be constructed in two ways. Firstly:</p>
  
  <pre><code>SELECT * 
  FROM TABLE 
  WHERE ITEM NOT IN ('item1', 'item2', 'item3', 'item4','item5')
  </code></pre>
  
  <p>Or, it can be written as:</p>
  
  <pre><code>SELECT * 
  FROM TABLE 
  WHERE ITEM != 'item1' 
    AND ITEM != 'item2' 
    AND ITEM != 'item3' 
    AND ITEM != 'item4' 
    AND ITEM != 'item5'
  </code></pre>
  
  <ol>
  <li>Which is more efficient and why?</li>
  <li>At what point does one become more efficient than the other? In other words, what if there were 500 items? </li>
  </ol>
  
  <p>My question is specifically relating to PostgreSQL.</p>