From: Michael Fuhr <mike@fuhr.org>
To: Pradeep Sharma <pradeep.sharma@in2m.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Creation date of postgres database
Date: Thu, 30 Mar 2006 05:27:12 -0700
Message-ID: <20060330122712.GA17708@winnie.fuhr.org> (raw)
In-Reply-To: <Pine.LNX.4.63.0603301715350.13116@linux.site>
References: <Pine.LNX.4.63.0603301403050.6505@linux.site>
<20060330110626.GA98684@winnie.fuhr.org>
<Pine.LNX.4.63.0603301715350.13116@linux.site>
On Thu, Mar 30, 2006 at 05:20:00PM +0530, Pradeep Sharma wrote:
> Thanks for the reply. But I guess there is some communication gap between
> me and you regarding this topic. As I understood from your reply is, you
> are talking about the date of Postgres setup/installation/upgrade.
No, I was talking about the creation time of a particular database.
> Suppose I created a new database using the command:
>
> CREATE DATABASE <database_name>
>
> I want to know how can I get created date of the above database.
As I mentioned, unless you logged the CREATE DATABASE statement I
don't think the creation date is stored anywhere, but you could
look at the modification times of the oldest files in the database's
directory. For example, one of my databases is named test. I can
find that database's oid by querying pg_database:
test=> SELECT oid FROM pg_database WHERE datname = 'test';
oid
-------
16388
(1 row)
I then list the files in that database's directory, sorted by time:
% ls -lt $PGDATA/base/16388 | tail -2
-rw------- 1 postgres postgres 4 Dec 6 09:39 PG_VERSION
-rw------- 1 postgres postgres 0 Dec 6 09:39 1248
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mike@fuhr.org, pradeep.sharma@in2m.com
Subject: Re: Creation date of postgres database
In-Reply-To: <20060330122712.GA17708@winnie.fuhr.org>
References: <Pine.LNX.4.63.0603301403050.6505@linux.site> <20060330110626.GA98684@winnie.fuhr.org> <Pine.LNX.4.63.0603301715350.13116@linux.site> <20060330122712.GA17708@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox