How to find table creation time?

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:

  • 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).

Leave a Comment