Postgres query optmization
- by hdx
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?