PG数据库更新删除卡死现象

-- 检查数据库中的XA事务状态
SELECT * FROM pg_prepared_xacts;
-- 回滚
ROLLBACK PREPARED '201_4x1X83sthDvC0js/5ImvIgAAAAAQAAAAAAAAAA==_EIa6gQ==';
-- 查找连接到目标数据库的会话
SELECT pid, state, usename, query
FROM pg_stat_activity
WHERE datname = 'db_bigdata';

-- 终止这些会话
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname = 'db_bigdata';


-- 查找已准备好的事务
SELECT gid, prepared, owner, database
FROM pg_prepared_xacts
WHERE database = 'db_bigdata';

-- 提交或回滚预备事务
COMMIT PREPARED '
gid;
 -- 终止所有已准备好的事务 这个gid指具体的值
ROLLBACK PREPARED 'gid';
posted @ 2024-06-17 11:36  蛋挞小子  阅读(20)  评论(0编辑  收藏  举报