重庆思庄Oracle、Redhat认证学习论坛

标题: pg 怎么查看最后的 checkpoint 时间呢 [打印本页]

作者: 郑全    时间: 7 天前
标题: pg 怎么查看最后的 checkpoint 时间呢


可以通过pg_controldata来获取,如下:

在一个窗口执行以下语句,获得时间
postgres=# select now();
             now              
------------------------------
2024-11-21 11:02:10.25855+08
(1 row)

postgres=# checkpoint;
CHECKPOINT
postgres=#



在另外一个窗口执行:
[postgres@standby ~]$ pg_controldata |grep -i checkpoint
Latest checkpoint location:           0/15C8AC0
Latest checkpoint's REDO location:    0/15C8A88
Latest checkpoint's REDO WAL file:    000000010000000000000001
Latest checkpoint's TimeLineID:       1
Latest checkpoint's PrevTimeLineID:   1
Latest checkpoint's full_page_writes: on
Latest checkpoint's NextXID:          0:754
Latest checkpoint's NextOID:          16403
Latest checkpoint's NextMultiXactId:  1
Latest checkpoint's NextMultiOffset:  0
Latest checkpoint's oldestXID:        723
Latest checkpoint's oldestXID's DB:   1
Latest checkpoint's oldestActiveXID:  754
Latest checkpoint's oldestMultiXid:   1
Latest checkpoint's oldestMulti's DB: 1
Latest checkpoint's oldestCommitTsXid:0
Latest checkpoint's newestCommitTsXid:0
Time of latest checkpoint:            Thu 21 Nov 2024 11:02:14 AM CST
[postgres@standby ~]$



再去第一个窗口执行checkpoint;
postgres=# select now();
              now              
-------------------------------
2024-11-21 11:03:59.888251+08
(1 row)

postgres=# checkpoint;
CHECKPOINT
postgres=#


再去第二个窗口检查:

[postgres@standby ~]$ pg_controldata |grep -i checkpoint
Latest checkpoint location:           0/15C8BA8
Latest checkpoint's REDO location:    0/15C8B70
Latest checkpoint's REDO WAL file:    000000010000000000000001
Latest checkpoint's TimeLineID:       1
Latest checkpoint's PrevTimeLineID:   1
Latest checkpoint's full_page_writes: on
Latest checkpoint's NextXID:          0:754
Latest checkpoint's NextOID:          16403
Latest checkpoint's NextMultiXactId:  1
Latest checkpoint's NextMultiOffset:  0
Latest checkpoint's oldestXID:        723
Latest checkpoint's oldestXID's DB:   1
Latest checkpoint's oldestActiveXID:  754
Latest checkpoint's oldestMultiXid:   1
Latest checkpoint's oldestMulti's DB: 1
Latest checkpoint's oldestCommitTsXid:0
Latest checkpoint's newestCommitTsXid:0
Time of latest checkpoint:            Thu 21 Nov 2024 11:04:04 AM CST
[postgres@standby ~]$


不是看到这个时间了







欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2