postgresql 10.x 叫做 wal、lsn
postgresql 9.x 叫做 xlog、location

在实际应用中经常需要根据 lsn/location 获取 wal/xlog 文件名

postgresql 10.x

postgres=# select pg_current_wal_lsn();
 pg_current_wal_lsn 
--------------------
 0/1656FE0
(1 row)

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   

--------------------+--------------------------+------------------------------------
 0/1656FE0          | 000000010000000000000001 | (000000010000000000000001,6647776)
(1 row)

postgresql 9.x

postgres=# select pg_current_xlog_location();
 pg_current_xlog_location 
--------------------------
 596/C4DA2000
(1 row)

postgres=# select pg_current_xlog_location(),
                  pg_xlogfile_name(pg_current_xlog_location()),
                  pg_xlogfile_name_offset(pg_current_xlog_location());

 pg_current_xlog_location |     pg_xlogfile_name     |       pg_xlogfile_name_offset       
--------------------------+--------------------------+-------------------------------------
 596/C4DA2000             | 0000000100000596000000C4 | (0000000100000596000000C4,14295040)

(1 row)

相关文章:

  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
  • 2021-10-19
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-06
  • 2021-11-12
  • 2021-09-22
  • 2022-02-05
相关资源
相似解决方案