title: Postgres deadlock detector not always working?
body: <p>We were recently having some problems with deadlocks in Posgres 9.4.
  Some queries were simply not returning and would just hang indefinitely.
  After some investigation we found that process deadlocking seemed to be the problem. When running the queries from the <a href="https://wiki.postgresql.org/wiki/Lock_Monitoring" rel="nofollow">Lock Monitoring</a> Postgres Wiki, we would see a whole bunch of blocked processes. The only way to resolve them was then to start killing some of those processes until Postgres could figure things out again.</p>
  
  <p>Now my understanding was that the deadlock detector in Postgres should be able to figure out that there is a deadlock and then proceed to resolve it by rolling back one of the blocked transactions, so that the other one could proceed and then retrying the first one.
  But that is not what happened in our case, these processes where just deadlocked indefinitely until we killed them.</p>
  
  <p>The <code>deadlock_timeout</code> was set to 1s (the default) and I could not find a flag to turn the deadlock detector on or off, so I assume it is always on.</p>
  
  <p>So my question is whether the deadlock detector can only detect some types of deadlocks and if so, which ones?</p>
  
  <p>And how come the queries shown on the Lock Monitoring Wiki can detect the deadlocked processes but the deadlock detector itself cannot?</p>