From: | Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com> |
---|---|
To: | Claudio Freire <klaussfreire(at)gmail(dot)com> |
Cc: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Anibal David Acosta <aa(at)devshock(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: how to avoid deadlock on masive update with multiples delete |
Date: | 2012-10-05 15:08:19 |
Message-ID: | CAOtHd0A0UNJYTeVDsn6uY2d-6f2+=s5EkQFwNV0ASa4PqAk8yw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
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)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-10-05 15:31:43 | Re: how to avoid deadlock on masive update with multiples delete |
Previous Message | Claudio Freire | 2012-10-05 14:27:13 | Re: how to avoid deadlock on masive update with multiples delete |