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 DC67911F6623 for ; Thu, 30 Mar 2006 08:27:25 -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 38012-02 for ; Thu, 30 Mar 2006 08:27:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 7DC9A11F662D for ; Thu, 30 Mar 2006 08:27:23 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id k2UCRDes018412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 30 Mar 2006 05:27:16 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id k2UCRDev018782; Thu, 30 Mar 2006 05:27:13 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id k2UCRCv5018781; Thu, 30 Mar 2006 05:27:12 -0700 (MST) (envelope-from mfuhr) Date: Thu, 30 Mar 2006 05:27:12 -0700 From: Michael Fuhr To: Pradeep Sharma Cc: pgsql-admin@postgresql.org Subject: Re: Creation date of postgres database Message-ID: <20060330122712.GA17708@winnie.fuhr.org> References: <20060330110626.GA98684@winnie.fuhr.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.121 required=5 tests=[AWL=0.121] X-Spam-Score: 0.121 X-Spam-Level: X-Archive-Number: 200603/371 X-Sequence-Number: 21128 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