Re: how to avoid deadlock on masive update with multiples delete - Mailing list pgsql-performance

From Maciek Sakrejda
Subject Re: how to avoid deadlock on masive update with multiples delete
Date
Msg-id CAOtHd0A0UNJYTeVDsn6uY2d-6f2+=s5EkQFwNV0ASa4PqAk8yw@mail.gmail.com
Whole thread Raw
In response to Re: how to avoid deadlock on masive update with multiples delete  (Claudio Freire <klaussfreire@gmail.com>)
Responses Re: how to avoid deadlock on masive update with multiples delete
List 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)


pgsql-performance by date:

Previous
From: Claudio Freire
Date:
Subject: Re: how to avoid deadlock on masive update with multiples delete
Next
From: Tom Lane
Date:
Subject: Re: how to avoid deadlock on masive update with multiples delete