person_add

How to reset locks in postgresql tables

Database : SQL

Posted by Maravilla 5 months ago



  • Maravilla 2 weeks ago

    Another working solutions 

     

    Get the active locks from pg_locks:

    SELECT t.relname, l.locktype, page, virtualtransaction, pid, mode, granted FROM pg_locks l, pg_stat_all_tables t WHERE l.relation = t.relid ORDER BY relation asc;

    Copy the pid(ex: 14210) from above result and substitute in the below command.

    SELECT pg_terminate_backend(14210)

    link : https://stackoverflow.com/questions/1063043/how-to-release-possible-postgres-row-locks


    Reply


  • Maravilla 2 weeks ago

    Another working solutions 

     

    Get the active locks from pg_locks:

    SELECT t.relname, l.locktype, page, virtualtransaction, pid, mode, granted FROM pg_locks l, pg_stat_all_tables t WHERE l.relation = t.relid ORDER BY relation asc;

    Copy the pid(ex: 14210) from above result and substitute in the below command.

    SELECT pg_terminate_backend(14210)

    link : https://stackoverflow.com/questions/1063043/how-to-release-possible-postgres-row-locks


    Reply


  • Maravilla 2 weeks ago

    Another working solutions 

     

    Get the active locks from pg_locks:

    SELECT t.relname, l.locktype, page, virtualtransaction, pid, mode, granted FROM pg_locks l, pg_stat_all_tables t WHERE l.relation = t.relid ORDER BY relation asc;

    Copy the pid(ex: 14210) from above result and substitute in the below command.

    SELECT pg_terminate_backend(14210)

    link : https://stackoverflow.com/questions/1063043/how-to-release-possible-postgres-row-locks


    Reply


Your answer!



Similars contributions