How to set timeout for exclusive lock in PostgreSQL

Posted by Low Kian Seong on Stack Overflow See other posts from Stack Overflow or by Low Kian Seong
Published on 2011-01-12T09:10:37Z Indexed on 2011/01/15 8:53 UTC
Read the original article Hit count: 267

Filed under:

I have an import script that was failing because of the 'Exclusive nowait' option I set my script. This caused the script to error out the first time it could not get the exclusive lock on the table. My script did it this way:

"LOCK TABLE %s IN EXCLUSIVE MODE NOWAIT"

Now my script works it's just that I want to be able to set the timeout for PostgreSQL instead of having it wait for the maximum time which is 15mins. I prefer to set it in posgresql.conf. Is there a way to do this?

© Stack Overflow or respective owner

Related posts about postgresql