个人技术分享

1.通过控制文件中的数据库唯一标识符(Database system identifier)计算数据库创建时间

[postgres@pg ~]$ pg_controldata 
Database system identifier: 7301135029075117750

postgres=# select to_timestamp(((7301135029075117750>>32) & (2^32 -1)::bigint));
      to_timestamp      
------------------------
 2023-11-14 10:12:48+08
(1 row)

2.通过查看数据库基本数据文件的信息

cd /pgsql15.4/data/base/1

ll PG_VERSION 
-rw-------. 1 postgres postgres 3 Nov 14  2023 PG_VERSION