本文介绍了PostgreSQL:表创建时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Postgresql中查找表创建时间.
How can I find the table creation time in Postgresql.
示例
如果创建了文件,我可以找到文件创建时间,就像我想知道表创建时间一样.
If I created a file I can find the file creation time like that I want to know the table creation time.
推荐答案我浏览了pg_ *表,但在那里找不到任何创建时间.可以找到表文件,但是在Linux上您无法获得文件创建时间.因此,我认为答案是,您只能通过以下步骤在Windows上找到此信息:
I had a look through the pg_* tables, and I couldn't find any creation times in there. It's possible to locate the table files, but then on Linux you can't get file creation time. So I think the answer is that you can only find this information on Windows, using the following steps:
- 使用select datname, datdba from pg_database; 获取数据库ID
- 使用select relname, relfilenode from pg_class; 获取表filenode ID
- 查找表文件并查找其创建时间;我认为该位置应类似于<PostgreSQL folder>/main/base/<database id>/<table filenode id>(不确定Windows上的位置).
- get the database id with select datname, datdba from pg_database;
- get the table filenode id with select relname, relfilenode from pg_class;
- find the table file and look up its creation time; I think the location should be something like <PostgreSQL folder>/main/base/<database id>/<table filenode id> (not sure what it is on Windows).
更多推荐
PostgreSQL:表创建时间
发布评论