Postgres query optmization

Posted by hdx on Stack Overflow See other posts from Stack Overflow or by hdx
Published on 2010-04-29T00:59:05Z Indexed on 2010/04/29 1:07 UTC
Read the original article Hit count: 414

Hey guys, trying to optimize this query to solve a duplicate user issue:

SELECT userid, 'ismaster' AS name, 'false' AS propvalue FROM user 
WHERE userid NOT IN (SELECT userid FROM userprop WHERE name = 'ismaster');

The problem is that the select after the NOT IN is 120.000 records and it's taking forever.

Any suggestion?

© Stack Overflow or respective owner

Related posts about sql

Related posts about postgresql