Search Postgresql Archives

Re: Deleting 173000 records takes forever, blocks async queries for unrelated records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>># delete from pref_users
>>where id not in (select distinct id from pref_money) limit 10;
>>ERROR:  syntax error at or near "limit"
>>LINE 2: ...ere id not in (select distinct id from pref_money) limit 10;

Or this?

DELETE FROM pref_users
WHERE id IN (
	SELECT id
	FROM pref_users
	WHERE id NOT IN (
		SELECT DISTINCT id
		FROM pref_money
	)
	LIMIT 10
);

Saw elsewhere another suggestion with EXCEPT, which is also sexy.



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux