How to set timeout for exclusive lock in PostgreSQL
- by Low Kian Seong
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?