I'm working with postgresql database and want to improve query (First one). I rewritten it to Second one. But I read article, which says that "NOT IN" is very slow construction. I want you to tell which of two is faster and/or suggest better solution.
First query
UPDATE reseller_product d SET status=3 FROM (
SELECT reseller_product.sku FROM reseller_product
LEFT OUTER JOIN main_table ON main_table.sku=reseller_product.sku
WHERE main_table.sku IS NULL AND reseller_product.reseller_id='||resID||'
)as r
WHERE d.sku=r.sku and d.distributor_id='||distrID||' and d.reseller_id='||resID||'
Second query
UPDATE reseller_product SET status=3
WHERE distributor_id='||distrID||' AND reseller_id='||resID||'
AND sku NOT IN (SELECT sku FROM main_table);
EDIT
Sorry, didn't notice error with name "d" in second query