PG中的常用系统信息函数
查看当前日志文件lsn位置:
1 2 | select pg_current_xlog_location(); select pg_current_wal_lsn(); |
当前xlog buffer中的insert位置,注意和上面pg_current_xlog_location()的区别:
1 | select pg_current_xlog_insert_location(); |
查看某个lsn对应的日志名:
1 2 | select pg_xlogfile_name(lsn); select pg_walfile_name(lsn); |
查看某个lsn在日志中的偏移量:
1 2 | select pg_xlogfile_name_offset('lsn'); select pg_walfile_name_offset('lsn'); |
查看两个lsn位置的差距: