title: NOT EXISTS clause in Postgresql
body: <p>Anyone knows how to perform such query in Postgresql?</p>
  
  <pre><code>SELECT * 
  FROM tabA 
  WHERE NOT EXISTS (
      SELECT * 
      FROM tabB 
      WHERE tabB.id = tabA.id
  )
  </code></pre>
  
  <p>When I execute such query, postgresql complains "<code>ERROR: Greenplum Database does not yet support that query</code>."</p>
  
  <p>EDIT: And how about this one:</p>
  
  <pre><code>SELECT * 
  FROM tabA 
  WHERE NOT EXISTS (
      SELECT * 
      FROM tabB WHERE tabB.id = tabA.id AND tabB.id2 = tabA.id2
  )
  </code></pre>
  
  <p><strong>EDIT:</strong> <BR>
  I tested in postgresql 8.2.15 for the 4 answers provided by @ypercube. Conclusions are:<BR><BR>
  1) The first does not work in this version of postgresql, as I said above in the question. The error message can be found there too. <BR><BR>
  2) For the other three answers, the execution speed is: (3)LEFT JOIN > (4)EXCEPT >> (2)NOT IN. <br>Specifically, for queries that have the same syntax, (3)LEFT JOIN takes about 5580ms, (4)EXCEPT takes about 13502ms, and (2)NOT IN takes more than 100000 (In fact I did not wait util it finished). <BR>
  <strong>Is there any particular reasons for NOT IN clause to be so slow?</strong> <BR>
  Cheng</p>