This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing an important parameter which we can use for setting a wait time before deadlock occurs in PostgreSQL.
The parameter is deadlock_timeout (integer). The default is one second which is very less time.
Before any deadlock, there is a blocked transaction situation. In most of the cases, we can avoid the deadlock by checking or solving the blocking situation. So in this situation, database engine has to wait before generating the deadlock.
Using deadlock_timeout parameter, we can set the wait time for deadlock situation.
Increasing this value reduces the amount of time wasted in needless deadlock checks, but slows down reporting of real deadlock errors.
Change the value of the deadlock_timeout parameter in postgresql.conf file.