#PostgreSQL
共 234 篇文章
PostgreSQL 报错 replication slot is active PID 槽位锁死清理
生产 PG 库因从库离线或 CDC 抽取异常,导致复制槽持续积压 WAL 撑爆磁盘,执行删除时抛出 cannot drop replication slot: slot is active with PID。本文详解槽位解除与安全清理流程。
解决 PostgreSQL 执行 DDL 报错 could not obtain lock on relation
分析 PostgreSQL 执行 ALTER TABLE 报 could not obtain lock 诱因,详解 AccessExclusiveLock 排他锁与并发加索引。
解决 PostgreSQL 报错 remaining connection slots are reserved
分析 PostgreSQL 达到 max_connections 连接配额耗尽与预留连接机制,详解 PgBouncer 连接池调优方案。
解决 PostgreSQL 报错 value too long for type character varying 字符串截断修复
排查 PostgreSQL 插入字符串抛出 ERROR: value too long for type character varying(255),将字段扩容或升级为无限制 TEXT 类型。
解决 PostgreSQL 报错 the database system is not accepting connections
分析 PostgreSQL 节点启动时报 the database system is starting up 或 recovery in progress 根因,提供 WAL 恢复监控与只读模式配置方案。
解决 PostgreSQL 报错 remaining connection slots are reserved 连接耗尽
分析 PostgreSQL 连接数触顶报 remaining connection slots are reserved 根因,提供 idle 会话清理、max_connections 与 PgBouncer 部署方案。
解决 PostgreSQL 报错 out of shared memory: max_locks_per_transaction 调优指南
排查 PostgreSQL 批量操作或大分区表查询提示 out of shared memory 错误,深度解析共享内存锁表与 max_locks_per_transaction 调优。
解决 pgpool-II 报错 pool_passwd md5 password mismatch 认证凭据不同步修复
排查 客户端通过 pgpool-II 连接报错 password authentication failed for user,日志显示 pool_passwd entry mismatch,分析 密码认证同步与 pg_md5 工具。
解决 PostgreSQL 报错 remaining connection slots are reserved for non-replication superusers 的排查指南
排查与解决 PostgreSQL 客户端连接池打满提示 remaining connection slots are reserved 连接耗尽的完整方案。
解决 PostgreSQL 报错 cannot truncate a table referenced in a foreign key
分析 PostgreSQL 执行 TRUNCATE TABLE 遇到外键引用报 0A000 根因,提供 TRUNCATE ... CASCADE 级联排空与多表联合清空步骤。
PostgreSQL 只读从库 canceling statement due to conflict with recovery 排查
分析 PostgreSQL 只读从节点复制冲突导致查询被取消的底层原因,提供 max_standby 延迟与热备查询调优方案。
解决 PostgreSQL 报错 cannot change return type of existing function
分析 PostgreSQL 执行 CREATE OR REPLACE FUNCTION 修改返回值类型报 42P13 根因,提供带参数签名的 DROP FUNCTION 替换步骤。
解决 SonarQube 报错 Database collation unsupported 字符集拒绝启动修复
排查 SonarQube 连接 PostgreSQL 报错 Database collation unsupported: Expected ... got Chinese_PRC 或 utf8mb4,分析 字符排序规则。
PostgreSQL deadlock detected 死锁排查与事务锁治理
深入排查 PostgreSQL 并发事务执行时抛出 ERROR: deadlock detected 的底层形成条件,使用 deadlock_timeout 与 pg_stat_activity 进行死锁日志捕获与代码锁顺序规整实战。
解决 PostgreSQL 报错 canceling statement due to timeout 指南
分析 PostgreSQL 执行慢查询被 statement_timeout 强行取消的排查方法,提供会话级覆盖与慢 SQL 索引调优指南。
解决 PostgreSQL 报错 cannot truncate a table referenced in a foreign key 约束
分析 PostgreSQL 清空主表因外键约束受阻报 0A000 根因,提供 TRUNCATE CASCADE 级联排空方案。
Npgsql COMMIT PREPARED 报不存在:检查被吞掉的事务错误
Npgsql 10.0.3 的两阶段事务组合中,SQL 已失败却继续 Complete,可能在后续 COMMIT PREPARED 才记录不存在。保留首个异常传播,仅在全部成功后完成作用域,并核对各参与者结果。
解决 PostgreSQL 报警 database must be vacuumed 事务 ID 回卷
分析 PostgreSQL 事务 ID 回卷警告诱因,详解 VACUUM FREEZE 冻结机制与 autovacuum 深度调优。
PostgreSQL 执行 CREATE INDEX CONCURRENTLY 导致严重锁等待:排查事务阻塞
生产高并发业务表进行性能优化时,DBA 执行 CREATE INDEX CONCURRENTLY 期望零停机平滑加索引,结果导致整张表的大量更新与插入发生严重锁超时。深入解析该命令两阶段扫描的锁机制及阻塞溯源排障方案。
解决 Patroni 报错 pg_rewind failed timeline diverged 时间线分叉修复
排查 Patroni 旧主节点重新加入集群报错 pg_rewind: fatal: could not find common ancestor between target and source,分析 预写日志保留与时间线回退。


