vlambda博客
学习文章列表

数据库优化语句/解锁语句 Postgres

参考1

https://www.php.cn/manual/view/20755.html

参考2

https://blog.csdn.net/weixin_34357928/article/details/86052178?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-2.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-2.control

//查询index 和表的大小SELECT relname, relpages FROM pg_class ORDER BY relpages DESC; //重新建立索引REINDEX TABLE 表名//清除被删除的列vacuum 表名vacuum 彻底清除 不过锁是排他锁//分析表 优化语句ANALYZE 表名//查看表是否被锁以及解锁select oid from pg_class where relname='表名'select pid from pg_locks where relation='上个语句查询的oid'select pg_cancel_backend('上个语句查询的pid')