Skip to content


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.

Related posts:

  1. Unit Test Your Database. I observe the endless war about TDD. On one side...
  2. Trying to Use Database in Python Why the f**** there is nothing like DBI in Python?...
  3. How to Store Application Settings Some ideas on how to store application settings in a...
  4. PostgreSQL Collation – part 2 Due to many questions about the PostgreSQL collation that were...
  5. Testing Database – Small Reply On Ovid’s blog I found lately this entry. First of...
  6. The Importance of Database Testing Basic Mistakes in Database Testing There is a huge number...

Posted in database.

Tagged with , .


2 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. juro says

    That’s really sad.
    However, some workaround is here
    http://www.varlena.com/GeneralBits/55.php
    in the post
    When was this database created?

  2. Simon says

    Youp… not really as this method just gives some approximation, not the real date.



Some HTML is OK

or, reply to this post via trackback.



Better Tag Cloud