Checking PostgreSQL Database Creation Date

Some time ago we had a problem: on testing there were many versions of similiar databases, created by loading production databases’ dumps. So on testing we had to drop some databases but we had problems with choosing which to drop. We wanted to leave only the latest one.

The Story

It was simple: just check the database creation date. Unfortunately that information is not being stored in the database. Someone said that it was simple: just check the database OID number and then check the creation date of appropriate directory under the `data` dir. Sounded cool.

Realization

Well, that all happened on a linux based server. The directory/file creation date is not being stored.

The End

That’s said… there is no way to check the database creation date on PostgreSQL.