X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EE4AA11F6AB8 for ; Thu, 30 Mar 2006 09:54:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75802-06 for ; Thu, 30 Mar 2006 09:54:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from in2m.com (unknown [202.68.136.247]) by postgresql.org (Postfix) with SMTP id 5F5E111F6A9E for ; Thu, 30 Mar 2006 09:54:36 -0400 (AST) Received: (qmail 14277 invoked from network); 30 Mar 2006 13:54:30 -0000 Received: from unknown (HELO pradeep) (202.68.136.242) by in2m.com with SMTP; 30 Mar 2006 13:54:30 -0000 Date: Thu, 30 Mar 2006 19:26:29 +0530 From: Pradeep Sharma X-X-Sender: pradeep@linux.site To: Michael Fuhr cc: pgsql-admin@postgresql.org Subject: Re: Creation date of postgres database In-Reply-To: <20060330122712.GA17708@winnie.fuhr.org> Message-ID: References: <20060330110626.GA98684@winnie.fuhr.org> <20060330122712.GA17708@winnie.fuhr.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.096 required=5 tests=[AWL=0.096] X-Spam-Score: 0.096 X-Spam-Level: X-Archive-Number: 200603/373 X-Sequence-Number: 21130 On Thu, 30 Mar 2006, Michael Fuhr wrote: > 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 > > > > 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 > > From this output I infer that the test database was created on 6 Dec. > Most files in the directory are susceptible to being modified but I > don't think anything touches PG_VERSION, so its modification time > should reflect the database creation time unless something at the > OS level modifies it. > > Try a command like the following: > > % ls -lt $PGDATA/base/*/PG_VERSION > > You should see that each database has a copy of this file and that > each file has a different modification time (some might be within > a few seconds of each other if databases were created around the > same time, such as during a restore). > > Is this not what you're looking for? > Thanks Micheal, This solved my problem. I got the creation date of my database. -- Pradeep > -- > Michael Fuhr > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org >