Presumably something like this?: maciek=# CREATE TABLE test AS SELECT g, random() FROM generate_series(1,1000) g; CREATE maciek=# EXPLAIN DELETE FROM test USING (SELECT g FROM test ORDER BY ctid) x where x.g = test.g; QUERY PLAN --------------------------------------------------------------------------------- Delete on test (cost=188.99..242.34 rows=1940 width=34) -> Hash Join (cost=188.99..242.34 rows=1940 width=34) Hash Cond: (x.g = public.test.g) -> Subquery Scan on x (cost=135.34..159.59 rows=1940 width=32) -> Sort (cost=135.34..140.19 rows=1940 width=10) Sort Key: public.test.ctid -> Seq Scan on test (cost=0.00..29.40 rows=1940 width=10) -> Hash (cost=29.40..29.40 rows=1940 width=10) -> Seq Scan on test (cost=0.00..29.40 rows=1940 width=10) (9 rows) -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance