pg_ls_archive_statusdir() 是一个用于检查 WAL 归档状态目录(pg_wal/archive_status)内容的系统函数。
pg_ls_archive_statusdir() 在 PostgreSQL 12 中被添加。
用法
pg_ls_archive_statusdir () → setof record (nametext,sizebigint,modificationtimestamp with time zone)
pg_ls_archive_statusdir() 返回 pg_wal/archive_status 目录中所有文件的列表,包括它们的大小和修改时间戳。
请注意,行不会按任何特定顺序返回,因此添加明确的排序标准可能很有用。
源代码
pg_ls_archive_statusdir() 实现于 src/backend/utils/adt/genfile.c。
变更历史
- PostgreSQL 12
- 添加于(提交 c4810162)
示例
postgres=# SELECT * FROM pg_ls_archive_statusdir() ORDER BY name;
name | size | modification
-----------------------------------------------+------+------------------------
000000010000000000000001.done | 0 | 2020-11-12 12:51:00+01
000000010000000000000002.00000028.backup.done | 0 | 2020-11-12 12:51:01+01
000000010000000000000002.done | 0 | 2020-11-12 12:51:01+01
000000010000000000000003.done | 0 | 2020-11-12 12:52:15+01
000000010000000000000004.ready | 0 | 2020-11-12 12:54:58+01
(5 rows)
参考资料
- PostgreSQL 文档: 通用文件访问函数
