Re: [araman@india-today.com: locking problem with JDBC (suspicion)]

From: Anand Raman <araman(at)india-today(dot)com>
To: postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: [araman@india-today.com: locking problem with JDBC (suspicion)]
Date: 2001-02-13 15:44:49
Message-ID: 20010213211449.E25941@india-today.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi guys

On Tue, Feb 13, 2001 at 10:07:57AM -0500, Tom Lane wrote:
>"Richard Huxton" <dev(at)archonet(dot)com> writes:
>> Well, foreign keys enforce constraints so it's not unreasonable that the
>> lock might extend to the referenced tables.
>

thanx tom
I got this point after pondering over it for some time..

>Precisely. The SELECT FOR UPDATE is done to ensure that the referenced
>rows don't go away before the update of the referencing table commits.
>

>I'm guessing that Anand's not shown us all the operations involved,
>and that when things hang up it's because there are two different
>transactions trying to lock overlapping sets of referenced rows.
>Hard to tell from the info we have, however.

as far as the entire picture is concerned here it comes..

EXHIBITS ------> EXHIBIT_DISTRIBUTIONS --- EXHIBIT_PRICES

where EXHIBITS is the primary table and has a one to many relationaship
with EXHIBIT_DISTRIBUTIONS. EXHIBIT_DISTRIBUTIONS has a one to one
relationship with EXHIBIT_PRICES.

In my web applicaiton i am first inserting the rows into EXHIBITS table
and in the next page ask the user to insert details regarding the
EXHIBIT_DISTRIBUTIONS. I pass the primary key from the first form to the
second and subsequently use it for inserting rows in
EXHIBIT_DISTRIBUTIONS.

The entire process works smoothly for the first few time.. However it
hangs when i repeat the process for more than 3 times..

I fail to understand if there is a problem then it would manifest itself
in the very first time.. HOwever why should it show upon the third
insert..

I can attach the postgres log files and the creation scripts if it helps..

Thanks for any suggestion..

Anand
>
> regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-02-13 15:48:22 Re: performance - self-joins vs. subqueries
Previous Message DaVinci 2001-02-13 15:32:17 Re: transaction safety