On 3/5/2012 11:15 AM, Nicolas Ribot wrote:
Hi,

Try the "NOT EXISTS" construct. I found it is order of magnitude
faster than "NOT IN".

It should be something like (test the query before using it, i'm not
sure of it :)

DELETE FROM portal.metadata
WHERE NOT EXISTS
(
    SELECT MIN(idx)
    FROM portal.metadata
    GROUP BY "data_object.unique_id"
);


ahh, no, I dont think that's right. min() will always return a record, so exists will always be true. exists() is true when count(*) > 0.

-Andy

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to