10.0及以后版本:
pg_walfile_name()
用法:
postgres=# select pg_current_wal_lsn(),
pg_walfile_name(pg_current_wal_lsn()),
pg_walfile_name_offset(pg_current_wal_lsn());
pg_current_wal_lsn | pg_walfile_name | pg_walfile_name_offset
--------------------+--------------------------+---------------------------------
2/C000840 | 00000001000000020000000C | (00000001000000020000000C,2112)
(1 row)
注:
pg_current_wal_lsn():获得当前wal日志写入位置。
pg_walfile_name(lsn pg_lsn):转换wal日志位置为文件名。
pg_walfile_name_offset(lsn pg_lsn):返回转换后的wal日志文件名和偏移量。
10.0之前版本:
postgres=# select pg_current_xlog_location(),
pg_xlogfile_name(pg_current_xlog_location()),
pg_xlogfile_name_offset(pg_current_xlog_location());