<?xml version="1.0" encoding="gbk"?>
<rss version="2.0">
  <channel>
    <title>重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛 - Postgre SQL</title>
    <link>http://bbs.cqsztech.com/forum.php?mod=forumdisplay&amp;fid=63</link>
    <description>Latest 20 threads of Postgre SQL</description>
    <copyright>Copyright(C) 重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛</copyright>
    <generator>Discuz! Board by Comsenz Inc.</generator>
    <lastBuildDate>Thu, 16 Apr 2026 01:33:49 +0000</lastBuildDate>
    <ttl>60</ttl>
    <image>
      <url>http://bbs.cqsztech.com/static/image/common/logo_88_31.gif</url>
      <title>重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛</title>
      <link>http://bbs.cqsztech.com/</link>
    </image>
    <item>
      <title>PG物理复制：主库归档失败，报错找不到路径</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33198</link>
      <description><![CDATA[1. 现象描述

在搭建 PostgreSQL 15 物理备库环境后，主备流复制虽然显示已连接，但主、备库日志中持续出现报错：

主库 (Primary) 日志：
LOG: archive command failed with exit code 1
DETAIL: The failed archive command was: cp pg_wal/000000010... /pg18/ ...]]></description>
      <category>Postgre SQL</category>
      <author>ZhangQi</author>
      <pubDate>Sun, 05 Apr 2026 03:18:41 +0000</pubDate>
    </item>
    <item>
      <title>pg数据库查询当前连接ip及相关连接数</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33281</link>
      <description><![CDATA[在 PostgreSQL 中，您可以通过查询系统内部的运行状态视图 pg_stat_activity 来查看当前所有连接的用户、IP 地址以及它们的运行状态。

这是最常用的标准查询语句：


SELECT
    datname AS database_name,
    usename AS user_name,
    client_addr AS clie ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 29 Mar 2026 13:03:54 +0000</pubDate>
    </item>
    <item>
      <title>为什么 RPM 安装的 PostgreSQL 可能缺少 devel 包</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33194</link>
      <description><![CDATA[现象回顾

在尝试编译 oracle_fdw 插件时，即便设置了 PATH，执行 make 依然报错：

&gt; `Makefile:30: /usr/pgsql-14/lib/pgxs/src/makefiles/pgxs.mk: 没有那个文件或目录



原因：RPM 安装缺少了该包

这正是 RPM（以及 DEB）包管理器的“按需分配”设计导 ...]]></description>
      <category>Postgre SQL</category>
      <author>ZhangQi</author>
      <pubDate>Sun, 29 Mar 2026 03:06:13 +0000</pubDate>
    </item>
    <item>
      <title>解决 oracle_fdw 报错：OCIEnvCreate failed to create environment handle</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33195</link>
      <description><![CDATA[1. 问题描述

在 PostgreSQL 中配置好 oracle_fdw 后，执行查询（如 SELECT * FROM foreign_table）时弹出以下错误：

ERROR: error connecting to Oracle: OCIEnvCreate failed to create environment handle



（oracle客户端已经配置好，oracle_fdw也成功编 ...]]></description>
      <category>Postgre SQL</category>
      <author>ZhangQi</author>
      <pubDate>Sun, 29 Mar 2026 03:05:58 +0000</pubDate>
    </item>
    <item>
      <title>当 echo $PGHOME 为空时，精准定位 PostgreSQL 安装目录</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33193</link>
      <description><![CDATA[背景

在配置 PostgreSQL 环境变量或执行升级操作时，经常需要用到 $PGHOME（软件安装根目录）。但在很多通过 yum 或 apt 自动安装的环境中（非源码编译），系统并不会默认设置这个全局变量。

第一步：定位命令入口

首先，我们看看常用的 psql 命令在哪里：whic ...]]></description>
      <category>Postgre SQL</category>
      <author>ZhangQi</author>
      <pubDate>Sun, 29 Mar 2026 03:05:48 +0000</pubDate>
    </item>
    <item>
      <title>PG物理备库搭建实施方案</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33258</link>
      <description><![CDATA[1.环境介绍
本方案搭建pg数据库的物理备库方案
配置如下所示。


2.前期准备
前期准备工作主要包含两大核心环节：一是检查主库数据库配置文件，二是实现备库 PostgreSQL 数据库的安装部署及对应配置。

2.1主库参数检查
检查wal_level配置，如果不是replica就 ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 22 Mar 2026 09:24:44 +0000</pubDate>
    </item>
    <item>
      <title>linux kill PG 后端进程 与 pg_ctl kill 对应关系</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33247</link>
      <description><![CDATA[在 PostgreSQL 里，pg_ctl kill 其实只是一个 信号发送工具，本质上就是帮你向 PostgreSQL 进程发送 Linux signal。
kill -15 对应的就是 SIGTERM。

而 pg_ctl kill 用的是 信号名称简写。

一、kill -15 对应的 pg_ctl 命令
Linux：

kill -15 
等价于：

 ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 15 Mar 2026 12:34:23 +0000</pubDate>
    </item>
    <item>
      <title>PostgreSQL 数据库windows服务器搭建测试库实施文档</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33211</link>
      <description><![CDATA[1. 实施背景与目标
任务目标： 将生产环境下的 PostgreSQL 数据库（含全局角色、postgres 系统库及 zlregister 业务库）克隆并部署到全新的测试环境中。

源环境（正式库）： Windows Server 2016

目标环境（测试库）： Windows Server 2016

迁移方式： 逻辑备 ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 08 Mar 2026 11:18:18 +0000</pubDate>
    </item>
    <item>
      <title>PG中 template0 与 template1区别</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33190</link>
      <description><![CDATA[1. 用途定位

2. 内容差异

3. 灵活性

4. 典型使用场景
使用 template0：

需要创建一个全新的、干净的数据库。
需要指定不同于默认的字符编码（如 SQL_ASCII）或区域设置（如 LC_COLLATE = \'C\'）。
不希望继承任何用户自定义的对象或配置。
使用 template ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 01 Mar 2026 09:45:28 +0000</pubDate>
    </item>
    <item>
      <title>深入浅出 Shared Buffers</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33188</link>
      <description><![CDATA[因为 PostgreSQL 不是线程模型 (截止 PG18，关于多线程的讨论也一直在进行中)，所以高度依赖共享内存来共享状态和数据，每个连接、每个后台任务都是独立 OS 进程，进程间靠共享内存通信，要理解 Shared Buffers ，必须先理解 PostgreSQL 为什么需要一块\&quot;所有进程都能看 ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 01 Mar 2026 09:39:37 +0000</pubDate>
    </item>
    <item>
      <title>手动执行pg_ctl导致Systemd服务状态失效</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33143</link>
      <description><![CDATA[1. 现象描述：数据库“在线”，服务却“崩溃”

Step 1: 数据库由 Systemd 正常启动，状态为 active (running)。



Step 2: 运维人员切换到 postgres 用户，执行了原生命令 pg_ctl restart。

Step 3: 数据库提示 server started，业务访问完全正常。



S ...]]></description>
      <category>Postgre SQL</category>
      <author>ZhangQi</author>
      <pubDate>Sat, 28 Feb 2026 07:53:12 +0000</pubDate>
    </item>
    <item>
      <title>pg_repack重组表报错：must have a primary key or not-null unique keys</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33126</link>
      <description><![CDATA[场景回放： 对表执行 pg_repack 时出现警告：WARNING: relation \&quot;public.emp\&quot; must have a primary key or not-null unique keys，导致操作终止。



原理解析： pg_repack 的核心优势是“不停机重组”。为了在搬运数据的同时记录并回放新增的变更（INSERT/UPDATE/D ...]]></description>
      <category>Postgre SQL</category>
      <author>ZhangQi</author>
      <pubDate>Sat, 28 Feb 2026 07:53:03 +0000</pubDate>
    </item>
    <item>
      <title>postgresql通信连接的方方面面</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33172</link>
      <description><![CDATA[一、会话保持
1.0通信方式的概念
Unix、UDP、TCP

Unix 套接字、UDP 套接字和 TCP 套接字是三种不同的套接字类型，它们的主要区别在于通信方式、使用场景以及协议栈的不同。让我们逐一了解它们的区别：
### 1. Unix 套接字 (Unix Domain Socket)
 类型：用于同一 ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 08 Feb 2026 12:00:21 +0000</pubDate>
    </item>
    <item>
      <title>pg_profile插件变更Schema报错不支持 SET SCHEMA</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33125</link>
      <description><![CDATA[在执行 ALTER EXTENSION pg_profile SET SCHEMA profile; 时报错：ERROR: extension \&quot;pg_profile\&quot; does not support SET SCHEMA。



原因分析： PostgreSQL 的扩展分为“可重定位（Relocatable）”和“不可重定位”两种。pg_profile 由于内部函数调用深度绑定了路 ...]]></description>
      <category>Postgre SQL</category>
      <author>ZhangQi</author>
      <pubDate>Sun, 08 Feb 2026 11:04:06 +0000</pubDate>
    </item>
    <item>
      <title>pg数据库如何开启大页内存</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33154</link>
      <description><![CDATA[第一部分：开启大页内存 (Huge Pages)
Linux 默认内存页大小是 4KB。对于几十 GB 的内存，管理这些小页表会消耗大量 CPU。开启 2MB 的大页可以降低开销。

1. 确认当前的 shared_buffers 大小
首先你需要知道你的 PostgreSQL 配置了多少共享内存。在数据库中执行： ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 01 Feb 2026 11:59:46 +0000</pubDate>
    </item>
    <item>
      <title>PostgreSQL SHARE UPDATE EXCLUSIVE 锁详解</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33153</link>
      <description><![CDATA[# PostgreSQL SHARE UPDATE EXCLUSIVE 锁详解

## 一、锁的基本概念与定位

在PostgreSQL的八级表锁体系中，`SHARE UPDATE EXCLUSIVE`（共享更新排他锁）处于中间偏上的强度层级，其锁模式数值通常被定义为4（按强度从低到高排序）。这种锁的设计初衷是为了平衡数据 ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 01 Feb 2026 11:54:37 +0000</pubDate>
    </item>
    <item>
      <title>pg数据库哪些参数可以不需要重启数据库就修改</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33152</link>
      <description><![CDATA[在 PostgreSQL (PG) 数据库中，参数能否在不重启的情况下修改，取决于该参数的 Context (上下文) 属性。

简单来说，除了 postmaster（需要重启）和 internal（编译时确定，不可改）这两种类型的参数外，绝大部分日常运维和调优参数都可以在不重启数据库的情况下修改 ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 01 Feb 2026 11:52:24 +0000</pubDate>
    </item>
    <item>
      <title>PostgreSQL高可用Patroni+Etcd</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33138</link>
      <description><![CDATA[Patroni 简介
Patroni基于Python开发的模板，结合DCS(例如 ZooKeeper, etcd, Consul )可以定制PostgreSQL&#12220;可&#12132;&#12101;案。Patroni并不是&#12032;套拿来即&#12132;的PostgreSQL&#12220;可&#12132;组件，涉及较多的配置和定制&#12079;作。Patroni接管Postg ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 25 Jan 2026 10:29:41 +0000</pubDate>
    </item>
    <item>
      <title>PostgreSQL SHARE UPDATE EXCLUSIVE 锁详解</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33137</link>
      <description><![CDATA[# PostgreSQL SHARE UPDATE EXCLUSIVE 锁详解

## 一、锁的基本概念与定位

在PostgreSQL的八级表锁体系中，`SHARE UPDATE EXCLUSIVE`（共享更新排他锁）处于中间偏上的强度层级，其锁模式数值通常被定义为4（按强度从低到高排序）。这种锁的设计初衷是为了平衡数据 ...]]></description>
      <category>Postgre SQL</category>
      <author>mahan</author>
      <pubDate>Sun, 25 Jan 2026 10:23:53 +0000</pubDate>
    </item>
    <item>
      <title>PG的主从复制，主库不开归档，能进行同步吗？</title>
      <link>http://bbs.cqsztech.com/forum.php?mod=viewthread&amp;tid=33135</link>
      <description><![CDATA[如题。


PG的主从复制，主库不开归档，能进行同步吗？


我们知道，在ORACLE，必须要开归档，才能进行DG，那么，PG呢？]]></description>
      <category>Postgre SQL</category>
      <author>郑全</author>
      <pubDate>Sun, 25 Jan 2026 10:04:31 +0000</pubDate>
    </item>
  </channel>
</rss>