Re: Dealing with locking on batch updates.

From: Vick Khera <vivek(at)khera(dot)org>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Dealing with locking on batch updates.
Date: 2010-11-02 13:24:36
Message-ID: AANLkTikiH6wXcYnLVPPSdCRfiFG7-Uvb_yUUT8ks4nOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Nov 2, 2010 at 5:47 AM, RP Khare
<passionate_programmer(at)hotmail(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Carlos Mennens 2010-11-02 14:02:05 Re: 8.4 Data Not Compatible with 9.0.1 Upgrade?
Previous Message Vick Khera 2010-11-02 13:21:18 Re: Replication