简体   繁体   中英

Lock table on postgresql 9.6

i'm new in postgres administration and when developper run LOCK TABLE tab1; with PREPARED statement , postgres use ACCES EXCLUSIVE BY DEFAULT. My probelem is that the lock in table is still here after one week in view pg_prepared_xact and pg_locks even after restart of postgres and in pg_lock is like:

 vXID                 mode
-1/192836             AccessExclusiveLock
Name               DATABASE                  Owner             XID          prepared at
                   db1                       postgres          192836       20-07-2021

I would know why the LOCK is still here?? and how to solve it? and what is mean -1 in vXID?? because i can't even show my data on tab1

with PREPARED statement

Prepared transactions and prepared statements are very different things. What you have here is a prepared transaction. Surviving a restart is what prepared transactions are for . You need to find its "gid" in pg_prepared_xacts and then either manually commit it or roll it back . If you are not intentionally using prepared transactions, the you should set max_prepared_transactions =0, so this can't recur. If you are intentionally using them, you need to learn how to handle them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM