Re: Dealing with locking on batch updates. - Mailing list pgsql-general

From Vick Khera
Subject Re: Dealing with locking on batch updates.
Date
Msg-id AANLkTikiH6wXcYnLVPPSdCRfiFG7-Uvb_yUUT8ks4nOA@mail.gmail.com
Whole thread Raw
In response to Dealing with locking on batch updates.  (RP Khare <passionate_programmer@hotmail.com>)
List pgsql-general
On Tue, Nov 2, 2010 at 5:47 AM, RP Khare
<passionate_programmer@hotmail.com> wrote:
> I want to know how we can handle this issue in PostgreSQL.
>

When you load your 50,000 record batch, do it inside a transaction
block and "SELECT FOR UPDATE" the rows instead of plain "SELECT".
That will lock those rows from being updated by other transactions,
which will just wait for your transaction to finish,  and conversely,
your transaction will not proceed until the other transactions have
released their update locks as well.

This is the most efficient way you can do locking.

pgsql-general by date:

Previous
From: Vick Khera
Date:
Subject: Re: Replication
Next
From: Carlos Mennens
Date:
Subject: Re: 8.4 Data Not Compatible with 9.0.1 Upgrade?