选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

文档 / 系统目录 / 系统视图

SYSTEM VIEW系统视图

pg_replication_slots

复制槽信息

系统视图 引入 9.4 现存至 20 devel 9 次结构变更

类别
系统视图
关系 OID
12261
关系类型
v(视图)
字段数
21
引入版本
9.4
版本状态
当前稳定版
结构变更
9 次

PostgreSQL 18 手册 官方文档

版本轨迹

相对 PostgreSQL 17:新增 1 个字段,描述更新 1 处。

pg_replication_slots视图提供当前数据库集簇中所有复制槽及其当前状态的列表。

有关复制槽的更多信息,请参见Section 26.2.6和Chapter 47。

字段

PostgreSQL 18 的 21 个字段,按定义顺序排列。说明默认用本站手册的译文,没有译文的按英文原文显示。

字段 类型 说明
slot_name name 一个集簇范围内唯一的复制槽标识符
plugin name 包含该逻辑槽所用输出插件的共享对象的基础名称;物理槽为 NULL。
slot_type text 槽类型:physical 或 logical
datoid oid pg_database.oid 与该槽关联的数据库 OID,或为 NULL。只有逻辑槽才有关联数据库。
database name pg_database.datname 与该槽关联的数据库名称,或为 NULL。只有逻辑槽才有关联数据库。
temporary boolean 如果这是一个临时复制槽则为真。临时槽不会保存到磁盘,并会在出错时或会话结束时自动删除。
active boolean 如果该槽当前正被用于流式传输则为真
active_pid integer 为该槽流式传输数据的会话的进程 ID。NULL 表示不活动。
xmin xid 该槽要求数据库保留的最旧事务。VACUUM 不能移除由任何更晚事务删除的元组。
catalog_xmin xid 该槽要求数据库保留的、影响系统目录的最旧事务。VACUUM 不能移除由任何更晚事务删除的目录元组。
restart_lsn pg_lsn 该槽的消费者仍可能需要的最旧 WAL 的地址(LSN),因此除非此 LSN 落后于当前 LSN 超过 max_slot_wal_keep_size,否则在检查点期间不会被自动删除。如果该槽的 LSN 从未被保留,则为 NULL。
confirmed_flush_lsn pg_lsn 逻辑槽消费者已确认接收到数据的地址(LSN)。在此 LSN 之前提交的事务所对应的数据将不再可用。物理槽为 NULL。
wal_status text 该槽所声明需要的 WAL 文件的可用性。可能值为:
safe_wal_size bigint 还可以写入 WAL 的字节数,使该槽不至于进入“lost”状态。对于已丢失的槽,以及 max_slot_wal_keep_size 为 -1 时,该值为 NULL。
two_phase boolean 如果该槽启用了预备事务解码则为真。物理槽始终为假。
two_phase_at pg_lsn 自哪个地址(LSN)起启用预备事务解码。对于 two_phase 为假的逻辑槽,以及物理槽,该值为 NULL。
inactive_since timestamp with time zone 槽变为不活动的时间。如果该槽当前正在被流式传输,则为 NULL。如果该槽变为无效,该值将不再更新。对于从主库同步而来的备库逻辑槽(其 synced 字段为 true),inactive_since 表示槽同步(参见 Section 47.2.3)最近一次停止的时间。如果该槽始终保持同步,则为 NULL。这有助于跟踪备库上的槽同步何时被中断。
conflicting boolean 如果该逻辑槽与恢复发生冲突(因此现已失效)则为真。当该列为真时,请检查 invalidation_reason 列以了解冲突原因。物理槽始终为 NULL。
invalidation_reason text 该槽失效的原因。逻辑槽和物理槽都可能设置该值。若该槽未失效,则为 NULL。可能值为:
failover boolean 如果这是一个允许同步到备库的逻辑槽则为真,这样逻辑复制就可以在故障切换后从新的主库恢复。物理槽始终为假。
synced boolean 如果这是一个从主库同步而来的逻辑槽则为真。在热备上,synced 列为真的槽既不能用于逻辑解码,也不能手工删除。该列在主库上的值没有意义;主库上该列默认对所有槽都为假,但也可能(如果是由已提升的备库遗留)为真。

演化历史

相邻两个大版本之间的差异,新的在前。版本号链到该版的字段表。

  1. PostgreSQL 19 ← 18 结构变更

    slotsync_skip_reason

  2. PostgreSQL 18 ← 17 结构变更

    two_phase_at

    1 处描述更新
    • inactive_since The time when the slot became inactive. NULL if the slot is currently being streamed. Note that for slots on the standby that are being synced from a primary server (whose synced field is true), the inactive_since indicates the time when slot synchronization (see Section 47.2.3) was most recently stopped. NULL if the slot has always been synchronized. On standby, this is useful for slots that are being synced from a primary server (whose synced field is true) so they know when the slot stopped being synchronized. The time when the slot became inactive. NULL if the slot is currently being streamed. If the slot becomes invalid, this value will never be updated. For standby slots that are being synced from a primary server (whose synced field is true), the inactive_since indicates the time when slot synchronization (see Section 47.2.3) was most recently stopped. NULL if the slot has always been synchronized. This helps standby slots track when synchronization was interrupted.
  3. PostgreSQL 17 ← 16 结构变更

    inactive_sinceinvalidation_reasonfailoversynced 关系说明更新

    3 处描述更新
    • active True if this slot is currently actively being used True if this slot is currently being streamed
    • active_pid The process ID of the session using this slot if the slot is currently actively being used. NULL if inactive. The process ID of the session streaming data for this slot. NULL if inactive.
    • conflicting True if this logical slot conflicted with recovery (and so is now invalidated). Always NULL for physical slots. True if this logical slot conflicted with recovery (and so is now invalidated). When this column is true, check invalidation_reason column for the conflict reason. Always NULL for physical slots.
  4. PostgreSQL 16 ← 15 结构变更

    conflicting

    2 处描述更新
    • confirmed_flush_lsn The address (LSN) up to which the logical slot's consumer has confirmed receiving data. Data older than this is not available anymore. NULL for physical slots. The address (LSN) up to which the logical slot's consumer has confirmed receiving data. Data corresponding to the transactions committed before this LSN is not available anymore. NULL for physical slots.
    • wal_status Availability of WAL files claimed by this slot. Possible values are: The last two states are seen only when max_slot_wal_keep_size is non-negative. Availability of WAL files claimed by this slot. Possible values are:
  5. PostgreSQL 14 ← 13 结构变更

    two_phase 关系说明更新

  6. PostgreSQL 13 ← 12 结构变更

    wal_statussafe_wal_size

    2 处描述更新
    • restart_lsn The address (LSN) of oldest WAL which still might be required by the consumer of this slot and thus won't be automatically removed during checkpoints. NULL if the LSN of this slot has never been reserved. The address (LSN) of oldest WAL which still might be required by the consumer of this slot and thus won't be automatically removed during checkpoints unless this LSN gets behind more than max_slot_wal_keep_size from the current LSN. NULL if the LSN of this slot has never been reserved.
    • slot_type The slot type - physical or logical The slot type: physical or logical
  7. PostgreSQL 12 ← 11 仅描述更新

    关系说明更新

  8. PostgreSQL 11 ← 10 仅描述更新

    关系说明更新

    1 处描述更新
    • restart_lsn The address (LSN) of oldest WAL which still might be required by the consumer of this slot and thus won't be automatically removed during checkpoints. The address (LSN) of oldest WAL which still might be required by the consumer of this slot and thus won't be automatically removed during checkpoints. NULL if the LSN of this slot has never been reserved.
  9. PostgreSQL 10 ← 9.6 结构变更

    temporary 关系说明更新

  10. PostgreSQL 9.6 ← 9.5 结构变更

    confirmed_flush_lsn 关系说明更新

  11. PostgreSQL 9.5 ← 9.4 结构变更

    active_pid

  12. PostgreSQL 9.4 ← 9.3 新增此关系

    共 9 个字段

字段矩阵

每个字段在 14 个收录版本里的存在情况;方格指向该版的字段表。「有变」指类型、可空、隐式或数组维数与上一版不同。

存在 有变 已移除 不存在

字段 9.49.59.61011121314151617181920
slot_name 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
plugin 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
slot_type 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
datoid 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
database 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
active 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
xmin 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
catalog_xmin 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
restart_lsn 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
active_pid 不存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
confirmed_flush_lsn 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
temporary 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
wal_status 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在
safe_wal_size 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在
two_phase 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在
conflicting 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在
inactive_since 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在
invalidation_reason 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在
failover 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在
synced 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在
two_phase_at 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在
slotsync_skip_reason 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在

同类关系

关系 引入 字段 版本变动 最近变更
SYSTEM VIEW 系统视图 39 个
pg_aios 18 15
正在使用的异步 I/O 句柄 现存
pg_available_extension_versions 9.1 10 192 次
扩展的可用版本 现存
pg_available_extensions 9.1 5 191 次
可用的扩展 现存
pg_backend_memory_contexts 14 10 181 次
后端内存上下文 现存
pg_config 9.6 2
编译时配置参数 现存
pg_cursors 9.0基线 6
打开的游标 现存
pg_dsm_registry_allocations 19 3
DSM 注册表跟踪的共享内存分配 现存
pg_file_settings 9.5 7
配置文件内容摘要 现存
pg_group 9.0基线 3
数据库用户组 现存
pg_hba_file_rules 10 11 161 次
客户端认证配置文件内容的摘要 现存
pg_ident_file_mappings 15 7 161 次
客户端用户名映射配置文件内容摘要 现存
pg_indexes 9.0基线 5
索引 现存
pg_locks 9.0基线 16 142 次
当前持有或等待的锁 现存
pg_matviews 9.3 7
物化视图 现存
pg_policies 9.5 8 101 次
策略 现存
pg_prepared_statements 9.0基线 8 162 次
预备语句 现存
pg_prepared_xacts 9.0基线 5
预备事务 现存
pg_publication_sequences 19 3
发布及其关联序列的信息 现存
pg_publication_tables 10 5 151 次
发布及其关联表的信息 现存
pg_replication_origin_status 9.5 4
有关复制源的信息,包括复制进度 现存
pg_replication_slots 9.4 22 199 次
复制槽信息 现存
pg_roles 9.0基线 13 9.52 次
数据库角色 现存
pg_rules 9.0基线 4
规则 现存
pg_seclabels 9.1 8
安全标签 现存
pg_sequences 10 11
序列 现存
pg_settings 9.0基线 17 9.51 次
参数设置 现存
pg_shadow 9.0基线 9 123 次
数据库用户 现存
pg_shmem_allocations 13 4
共享内存分配 现存
pg_shmem_allocations_numa 18 3
共享内存分配的 NUMA 节点映射 现存
pg_stats 9.0基线 19 193 次
规划器统计信息 现存
pg_stats_ext 12 17 193 次
扩展规划器统计信息 现存
pg_stats_ext_exprs 14 22 192 次
表达式的扩展规划器统计信息 现存
pg_tables 9.0基线 8 9.51 次
现存
pg_timezone_abbrevs 9.0基线 3
时区简写 现存
pg_timezone_names 9.0基线 4
时区名称 现存
pg_user 9.0基线 9 123 次
数据库用户 现存
pg_user_mappings 9.0基线 6
用户映射 现存
pg_views 9.0基线 4
视图 现存
pg_wait_events 17 3
等待事件 现存