Re: How to speed up Exclusive Locking

From: Richard Huxton <dev(at)archonet(dot)com>
To: David Goodenough <david(dot)goodenough(at)btconnect(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to speed up Exclusive Locking
Date: 2006-12-05 12:03:22
Message-ID: 4575600A.4020601@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David Goodenough wrote:
> On Tuesday 05 December 2006 10:57, Bernd Helmle wrote:
>> On Tue, 5 Dec 2006 10:18:21 +0000, David Goodenough
>> <david(dot)goodenough(at)btconnect(dot)com> wrote:
>>
>>> The statements issued to lock each table is:-
>>> LOCK TABLE table IN EXCLUSIVE MODE; SELECT 1 FROM table;
>> So why selecting '1' for each row after locking the relation before? I
>> don't know HA-JDBC but this looks really useless. Remove the SELECT and use
>> the LOCK TABLE command within the transaction which does the sync for you.

> I will give it a try.

It could be that the HA-JDBC code expects some selected value back. In
which case a simple "SELECT 1" should be fine. I have to agree with
Bernd that selecting all rows and then throwing away the results strikes
me as particularly a braindead behaviour from the library, presumably it
makes some sort of sense for locking a limited number of rows.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Goodenough 2006-12-05 12:11:51 Re: How to speed up Exclusive Locking
Previous Message deepak pal 2006-12-05 12:01:53 Time Stamp auto Field