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)
    
  • 相关阅读:
    静态化之优化
    SEO小技巧
    apache 工具和简单优化
    apache rewrite机制
    nginx php win平台配置
    mvc 简单模型
    php无限分类三种方式
    【转】sqlserver查询数据库中有多少个表
    【转】sqlserver数据库之间的表的复制
    SET ANSI_NULLS (TransactSQL)
  • 原文地址:https://www.cnblogs.com/ctypyb2002/p/9793046.html
Copyright © 2011-2022 走看看