Scott Ribe <scott_ribe@xxxxxxxxxxxxxxxx> writes: > Given errors like the pair you posted, my next step would be to examine the queries being executed by those processes during the deadlock. Now, I think by the time the deadlock error is logged, the queries involved have been cancelled, so it's possible the processes have gone on to another query and so pg_stat_activity might not have useful information, or it might--depending on what your app would do after a deadlock error. > If it does not, then the next thing would be to set log_min_duration_statement to less than deadlock/statement timeout, so that you could look through logs to figure out what are the two queries which are deadlocking against each other. The postmaster log should already contain the statements that deadlocked against each other --- that's what the "HINT: See server log for query details" is telling you. regards, tom lane