Re: strange (maybe) behaviour of table lock

From: Edoardo Panfili <edoardo(at)aspix(dot)it>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: strange (maybe) behaviour of table lock
Date: 2006-12-08 18:47:18
Message-ID: 4579B336.1050702@aspix.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Edoardo Panfili <edoardo(at)aspix(dot)it> writes:
>> I have a servlet that uses connection pools.
>> The servlet do "LOCK table,table2,table3,table4"
>> then do some select (I am testing the code, I will put the update in the
>> future) an then I close instruction and connection.
>> The first 4 executions of the servlet goes well, the 5th hangs.
>> Afther that I use "psql" to do the last query (the one that hangs the
>> system) of the servlet, also psql hangs.
>
> Look into the pg_locks view to find out what it's blocked on. Note that
> LOCK by default gets an ACCESS EXCLUSIVE lock, which means it will be
> blocked by *any* pre-existing access, even an open transaction that
> merely read the table awhile back. Are you sure you really need such a
> strong lock?

I don't need a "ACCESS EXCLUSIVE" thanks a lot for your help. I luk at
pg_locks, when my system hangs there are (it's right) loocked tables.

It seems that if I put some delay between calls to the servlet all goes
well. I can change lock level but ther is something wrong.

Obviously I am doiung something wrong. To unlock the tables is not
sufficient close the Statement and the Connection?

tanks again
Edoardo

--
edoardo(at)aspix(dot)it
AIM: edoardopn
Jabber: edoardopa(at)talk(dot)google(dot)com
tel:075 9142766

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-12-08 19:01:17 Re: strange (maybe) behaviour of table lock
Previous Message Matthew O'Connor 2006-12-08 18:38:52 Re: Re: Male/female