postgresql函数pg_walfile_name()
pg_walfile_name()是postgresql中用于把LSN转换成WAL文件名的一个系统函数,在做主备、流复制、pgpool、故障排查时非常常用。
1.pg_walfile_name()函数作用
根据给定的LSN,返回该LSN所在的WAL文件名。
SELECT pg_walfile_name(pg_current_wal_lsn());-bash-4.2$ psql psql (15.5) Type "help" for help. postgres=# SELECT pg_walfile_name(pg_current_wal_lsn()); pg_walfile_name -------------------------- 000000050000000000000009 (1 row) postgres=#