pg_stat_archiver

一个统计视图,显示有关 WAL 归档状态的信息

pg_stat_archiver 是一个 统计视图,显示有关通过 archive_command 参数归档的 WAL 文件的状态信息,包括最近成功和失败的归档尝试时间。

pg_stat_archiverPostgreSQL 9.4 中添加。

用法

pg_stat_archiver 收集了成功归档的 WAL 文件和归档失败的 WAL 文件的累计总数,并记录每个成功/失败的文件名和最后时间。

可以通过执行 pg_stat_reset_shared('archiver') 重置统计信息。

按 PostgreSQL 版本定义

pg_stat_archiver (PostgreSQL 17)

                       View "pg_catalog.pg_stat_archiver"
       Column       |           Type           | Collation | Nullable | Default 
--------------------+--------------------------+-----------+----------+---------
 archived_count     | bigint                   |           |          | 
 last_archived_wal  | text                     |           |          | 
 last_archived_time | timestamp with time zone |           |          | 
 failed_count       | bigint                   |           |          | 
 last_failed_wal    | text                     |           |          | 
 last_failed_time   | timestamp with time zone |           |          | 
 stats_reset        | timestamp with time zone |           |          |
    

文档: pg_stat_archiver

pg_stat_archiver (PostgreSQL 16)

                       View "pg_catalog.pg_stat_archiver"
       Column       |           Type           | Collation | Nullable | Default 
--------------------+--------------------------+-----------+----------+---------
 archived_count     | bigint                   |           |          | 
 last_archived_wal  | text                     |           |          | 
 last_archived_time | timestamp with time zone |           |          | 
 failed_count       | bigint                   |           |          | 
 last_failed_wal    | text                     |           |          | 
 last_failed_time   | timestamp with time zone |           |          | 
 stats_reset        | timestamp with time zone |           |          |
    

文档: pg_stat_archiver

pg_stat_archiver (PostgreSQL 15)

                       View "pg_catalog.pg_stat_archiver"
       Column       |           Type           | Collation | Nullable | Default 
--------------------+--------------------------+-----------+----------+---------
 archived_count     | bigint                   |           |          | 
 last_archived_wal  | text                     |           |          | 
 last_archived_time | timestamp with time zone |           |          | 
 failed_count       | bigint                   |           |          | 
 last_failed_wal    | text                     |           |          | 
 last_failed_time   | timestamp with time zone |           |          | 
 stats_reset        | timestamp with time zone |           |          |
    

文档: pg_stat_archiver

pg_stat_archiver (PostgreSQL 14)

                       View "pg_catalog.pg_stat_archiver"
       Column       |           Type           | Collation | Nullable | Default 
--------------------+--------------------------+-----------+----------+---------
 archived_count     | bigint                   |           |          | 
 last_archived_wal  | text                     |           |          | 
 last_archived_time | timestamp with time zone |           |          | 
 failed_count       | bigint                   |           |          | 
 last_failed_wal    | text                     |           |          | 
 last_failed_time   | timestamp with time zone |           |          | 
 stats_reset        | timestamp with time zone |           |          |
    

文档: pg_stat_archiver

pg_stat_archiver (PostgreSQL 13)

                       View "pg_catalog.pg_stat_archiver"
       Column       |           Type           | Collation | Nullable | Default 
--------------------+--------------------------+-----------+----------+---------
 archived_count     | bigint                   |           |          | 
 last_archived_wal  | text                     |           |          | 
 last_archived_time | timestamp with time zone |           |          | 
 failed_count       | bigint                   |           |          | 
 last_failed_wal    | text                     |           |          | 
 last_failed_time   | timestamp with time zone |           |          | 
 stats_reset        | timestamp with time zone |           |          |
    

文档: pg_stat_archiver

pg_stat_archiver (PostgreSQL 12)

                       View "pg_catalog.pg_stat_archiver"
       Column       |           Type           | Collation | Nullable | Default 
--------------------+--------------------------+-----------+----------+---------
 archived_count     | bigint                   |           |          | 
 last_archived_wal  | text                     |           |          | 
 last_archived_time | timestamp with time zone |           |          | 
 failed_count       | bigint                   |           |          | 
 last_failed_wal    | text                     |           |          | 
 last_failed_time   | timestamp with time zone |           |          | 
 stats_reset        | timestamp with time zone |           |          |
    

文档: pg_stat_archiver

pg_stat_archiver (PostgreSQL 11)

                       View "pg_catalog.pg_stat_archiver"
       Column       |           Type           | Collation | Nullable | Default 
--------------------+--------------------------+-----------+----------+---------
 archived_count     | bigint                   |           |          | 
 last_archived_wal  | text                     |           |          | 
 last_archived_time | timestamp with time zone |           |          | 
 failed_count       | bigint                   |           |          | 
 last_failed_wal    | text                     |           |          | 
 last_failed_time   | timestamp with time zone |           |          | 
 stats_reset        | timestamp with time zone |           |          |
    

文档: pg_stat_archiver

pg_stat_archiver (PostgreSQL 10)

                       View "pg_catalog.pg_stat_archiver"
       Column       |           Type           | Collation | Nullable | Default 
--------------------+--------------------------+-----------+----------+---------
 archived_count     | bigint                   |           |          | 
 last_archived_wal  | text                     |           |          | 
 last_archived_time | timestamp with time zone |           |          | 
 failed_count       | bigint                   |           |          | 
 last_failed_wal    | text                     |           |          | 
 last_failed_time   | timestamp with time zone |           |          | 
 stats_reset        | timestamp with time zone |           |          |
    

文档: pg_stat_archiver

pg_stat_archiver (PostgreSQL 9.6)

            View "pg_catalog.pg_stat_archiver"
       Column       |           Type           | Modifiers 
--------------------+--------------------------+-----------
 archived_count     | bigint                   | 
 last_archived_wal  | text                     | 
 last_archived_time | timestamp with time zone | 
 failed_count       | bigint                   | 
 last_failed_wal    | text                     | 
 last_failed_time   | timestamp with time zone | 
 stats_reset        | timestamp with time zone |
    

文档: pg_stat_archiver

pg_stat_archiver (PostgreSQL 9.5)

            View "pg_catalog.pg_stat_archiver"
       Column       |           Type           | Modifiers 
--------------------+--------------------------+-----------
 archived_count     | bigint                   | 
 last_archived_wal  | text                     | 
 last_archived_time | timestamp with time zone | 
 failed_count       | bigint                   | 
 last_failed_wal    | text                     | 
 last_failed_time   | timestamp with time zone | 
 stats_reset        | timestamp with time zone |
    

文档: pg_stat_archiver

pg_stat_archiver (PostgreSQL 9.4)

            View "pg_catalog.pg_stat_archiver"
       Column       |           Type           | Modifiers 
--------------------+--------------------------+-----------
 archived_count     | bigint                   | 
 last_archived_wal  | text                     | 
 last_archived_time | timestamp with time zone | 
 failed_count       | bigint                   | 
 last_failed_wal    | text                     | 
 last_failed_time   | timestamp with time zone | 
 stats_reset        | timestamp with time zone |
    

文档: pg_stat_archiver

更改历史记录

PostgreSQL 9.4 中引入以来,此视图没有被修改过。

示例

postgres=# SELECT * FROM pg_stat_archiver\gx
Expanded display is on.
-[ RECORD 1 ]------+------------------------------
archived_count     | 0
last_archived_wal  | 
last_archived_time | 
failed_count       | 135
last_failed_wal    | 000000010000000000000001
last_failed_time   | 2019-06-10 22:34:09.730097+02
stats_reset        | 2019-06-10 21:50:35.053854+02

分类

备份复制统计/监控视图WAL

另请参阅

pg_stat_replicationarchive_modearchive_commandpg_ls_archive_statusdir()pg_stat_reset_shared()

反馈

提交您对 "pg_stat_archiver" 的任何评论、建议或更正 在此处