From: Anibal David Acosta <aa@devshock.com>
To: 'Claudio Freire' <klaussfreire@gmail.com>
To: 'Jeff Janes' <jeff.janes@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: how to avoid deadlock on masive update with multiples delete
Date: Fri, 5 Oct 2012 14:33:49 -0400
Message-ID: <011201cda327$f99d73b0$ecd85b10$@devshock.com> (raw)
In-Reply-To: <CAGTBQpbK3K56Jzx_xU3ch1QB2TcnbwmQUd0T_98V6BoScGHOMg@mail.gmail.com>
References: <005701cda238$ba4d0350$2ee709f0$@devshock.com>
<CAMkU=1x_tM6ujEY39FUk=Lj2=NoT+-vJzoFMtwuKPN8Jd5PqrQ@mail.gmail.com>
<CAGTBQpbK3K56Jzx_xU3ch1QB2TcnbwmQUd0T_98V6BoScGHOMg@mail.gmail.com>
Process 1 (massive update): update table A set column1=0, column2=0
Process 2 (multiple delete): perform delete_row(user_name, column1, column2)
from table A where user_name=YYY
The pgsql function delete_row delete the row and do other business logic not
related to table A.
-----Mensaje original-----
De: Claudio Freire [mailto:klaussfreire@gmail.com]
Enviado el: viernes, 05 de octubre de 2012 10:27 a.m.
Para: Jeff Janes
CC: Anibal David Acosta; pgsql-performance@postgresql.org
Asunto: Re: [PERFORM] how to avoid deadlock on masive update with multiples
delete
On Thu, Oct 4, 2012 at 1:10 PM, Jeff Janes <jeff.janes@gmail.com> wrote:
> The bulk update could take an Exclusive (not Access Exclusive) lock.
> Or the delete could perhaps be arranged to delete the records in ctid
> order (although that might still deadlock). Or you could just repeat
> the failed transaction.
How do you make pg update/delete records, in bulk, in some particular order?
(ie, without issuing separate queries for each record)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: aa@devshock.com, klaussfreire@gmail.com, jeff.janes@gmail.com
Subject: Re: how to avoid deadlock on masive update with multiples delete
In-Reply-To: <011201cda327$f99d73b0$ecd85b10$@devshock.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox