zoukankan      html  css  js  c++  java
  • postgresql lsn/location 获取 wal/xlog 文件名

    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)
    
  • 相关阅读:
    如何使用分布式锁
    深入理解 ValueTask
    Tuple VS ValueTuple
    RxJS——调度器(Scheduler)
    RxJS——主题(Subject)
    RxJS——Operators
    RxJS——订阅(Subscription)
    RxJS——可观察的对象(Observable)
    Ext.Net 使用总结之GridPanel的删除事件
    使用 NuGet 管理项目库
  • 原文地址:https://www.cnblogs.com/ctypyb2002/p/9793046.html
Copyright © 2011-2022 走看看