Thread: locking problem with JDBC (suspicion)

locking problem with JDBC (suspicion)

From
Anand Raman
Date:
hi guys

I am facing problems with locks occasionally when using postgresql with
jdbc drivers..

I typically update a table exhibits which has 2 foreign keys from
artits table and a foreign key from atoday_users.. Sometimes this query simply hangs waiting for some
lock to be released.

This is a sample log entry which is generated when the process runs
smoothly..

StartTransactionCommand
query: insert into exhibits(exhibit_id,created_by,title,description,artist_id1,artist_id2) values (611,1001,'trial
sake',null,157,null)
ProcessQuery
query: SELECT oid FROM "artists" WHERE "artist_id" = $1 FOR UPDATE OF "artists"
query: SELECT oid FROM "atoday_users" WHERE "user_id" = $1 FOR UPDATE OF "atoday_users"
CommitTransactionCommand

this is the log entry which is generated when the process hangs..
StartTransactionCommand
query: insert into exhibits(exhibit_id,created_by,title,description,artist_id1,artist_id2) values (613,1001,'Painiting
1',null,56,null)
ProcessQuery
<<HANGS AFTER THIS>>

What could be the cause of this problem.. There arent many concurrent
transaction on the db engine.. Infact i am the only one who is using
this application now..

** MORE IMPORTANTG QUESTION **
Also why should insert into exhibits table lock a few rows from artists
and atoday_user for UPDATE.. Could this be the cause of the problem..

I am using  702..

Thanks
Anand