Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Check the <code>pg_stat_activity</code> view, there is probably some other transaction blocking the schema change.</p> <pre><code>select * from pg_stat_activity where not waiting and xact_start is not NULL order by xact_start; </code></pre> <p>The first row to show up is probably the one causing problems. It is often an "idle in transaction" - this may very well hold locks, and if it's an old transaction it may as well kill performance. Probably the programmer forgot to ensure ending the transaction with "commit" or "rollback", or maybe some db session got stuck due to network problems.</p> <p>To terminate transaction with pid 1234, use <code>select pg_cancel_backend(1234);</code> or (from the shell) <code>kill 1234</code>. If that fails, see <a href="https://serverfault.com/questions/35332/what-do-i-do-when-pg-cancel-backend-doesnt-work">https://serverfault.com/questions/35332/what-do-i-do-when-pg-cancel-backend-doesnt-work</a></p> <p>There is also a view <code>pg_locks</code> which may give some insight, though it may probably not be that easy to get any useful info out from it. If <code>granted</code> is true, the lock is held, when <code>granted</code> is false it means the query is waiting for the lock. Here are some more hints here on how to extract useful info from pg_locks: <a href="http://wiki.postgresql.org/wiki/Lock_Monitoring" rel="nofollow noreferrer">http://wiki.postgresql.org/wiki/Lock_Monitoring</a> </p> <p>If everything else fails, restarting postgres should clear all the locks (as well as long-running transactions).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload