环境
系统平台:Linux x86-64 Red Hat Enterprise Linux 7
版本:6.0,4.5
文档用途
本文档用于查询瀚高数据库的创建时间
详细信息
瀚高数据库可以通过控制文件的"Database system identifier"值来反推数据库的创建时间,方法如下:
方法1.通过pg_controldata查询出system identifier的值,通过to_timestamp函数将字符串转换为时间格式
[highgo@host ~]$ pg_controldata | grep "system identifier"
Database system identifier: 6940441653725889375
[highgo@host ~]$ psql highgo highgo
psql (HighGo Database 6 Release 6.0.2-64-bit Production)
PSQL: Release HighGo Database 6 Release 6.0.2-64-bit Production
Type "help" for help.
highgo=# select to_timestamp(6940441653725889375 >> 32);
to_timestamp
------------------------
2021-03-17 10:18:17+08
(1 row)
方法2.瀚高数据库提供函数pg_control_system可以直接查询出system identifier
highgo=# select to_timestamp(system_identifier >> 32) from pg_control_system();
to_timestamp
------------------------
2021-03-17 10:18:17+08
(1 row)