pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how to check the creation date of a postgres database?
13+ messages / 7 participants
[nested] [flat]

* how to check the creation date of a postgres database?
@ 2006-09-20 15:45 Jessica Richard <rjessil@yahoo.com>
  2006-09-20 16:07 ` Re: how to check the creation date of a postgres database? Chris Mair <chrisnospam@1006.org>
  2006-09-20 16:29 ` Re: how to check the creation date of a postgres Tomeh, Husam <htomeh@firstam.com>
  2006-09-22 02:52 ` Re: how to check the creation date of a postgres database? Jim Nasby <jim@nasby.net>
  0 siblings, 3 replies; 13+ messages in thread

From: Jessica Richard @ 2006-09-20 15:45 UTC (permalink / raw)
  To: pgsql-admin

\l and  \l+ show only the database name, owner and description.
select * from pg_database does not have date info, either.

I would like to know when each of my databases were created.

Thanks,
Jessica

 				
---------------------------------
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business.

^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres database?
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
@ 2006-09-20 16:07 ` Chris Mair <chrisnospam@1006.org>
  2006-09-20 16:52   ` Re: how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
  2 siblings, 1 reply; 13+ messages in thread

From: Chris Mair @ 2006-09-20 16:07 UTC (permalink / raw)
  To: Jessica Richard <rjessil@yahoo.com>; +Cc: pgsql-admin


> \l and  \l+ show only the database name, owner and description.
> select * from pg_database does not have date info, either.
> 
> I would like to know when each of my databases were created.

The only solution I can think of is querying
select oid, datname from pg_database;
and then look up the timestamps of the corresponding directories
in $PGDATA/base.

Bye, Chris.


-- 

Chris Mair
http://www.1006.org




^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres database?
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
  2006-09-20 16:07 ` Re: how to check the creation date of a postgres database? Chris Mair <chrisnospam@1006.org>
@ 2006-09-20 16:52   ` Jessica Richard <rjessil@yahoo.com>
  2006-09-20 17:00     ` Re: how to check the creation date of a postgres database? Chris Mair <chrisnospam@1006.org>
  0 siblings, 1 reply; 13+ messages in thread

From: Jessica Richard @ 2006-09-20 16:52 UTC (permalink / raw)
  To: Chris Mair <chrisnospam@1006.org>; +Cc: pgsql-admin

It didn't seem to work....
 
 I just checked one $PGDATA/base directory,  they all have today's time stamp (9/20/06)  around 6:00 am this morning, that was when my daily database dump cron job was running...
 
 thanks anyway
 
 

Chris Mair <chrisnospam@1006.org> wrote: 
> \l and  \l+ show only the database name, owner and description.
> select * from pg_database does not have date info, either.
> 
> I would like to know when each of my databases were created.

The only solution I can think of is querying
select oid, datname from pg_database;
and then look up the timestamps of the corresponding directories
in $PGDATA/base.

Bye, Chris.


-- 

Chris Mair
http://www.1006.org



 		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres database?
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
  2006-09-20 16:07 ` Re: how to check the creation date of a postgres database? Chris Mair <chrisnospam@1006.org>
  2006-09-20 16:52   ` Re: how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
@ 2006-09-20 17:00     ` Chris Mair <chrisnospam@1006.org>
  0 siblings, 0 replies; 13+ messages in thread

From: Chris Mair @ 2006-09-20 17:00 UTC (permalink / raw)
  To: Jessica Richard <rjessil@yahoo.com>; +Cc: pgsql-admin


> It didn't seem to work....
> 
> I just checked one $PGDATA/base directory,  they all have today's time
> stamp (9/20/06)  around 6:00 am this morning, that was when my daily
> database dump cron job was running...

You can check the PG_VERSION file under each database's directory as
Husam said...


Bye, Chris.






^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
@ 2006-09-20 16:29 ` Tomeh, Husam <htomeh@firstam.com>
  2006-09-20 16:58   ` Re: how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
  2 siblings, 1 reply; 13+ messages in thread

From: Tomeh, Husam @ 2006-09-20 16:29 UTC (permalink / raw)
  To: Jessica Richard <rjessil@yahoo.com>; pgsql-admin

 
I don't believe it's stored in the database. The closer you can get is
to check the date/timestamp of PG_VERSION file or possibly any file that
may have an earlier date/timestamp, under your database base
subdirectory ($PGDATA/base/your_database_oid/). For instance, for a
database with OID of 34332 :
 
ls -lt  $PGDATA/base/34332/PG*

-rw-------  1 postgres postgres 4 Aug 24 10:41 PG_VERSION
 
(Note that the PG_VERSION file in your $PGDATA data directory signifies
when the Postgres cluster was created, not a specific database)
 
--
  Husam
  http://firstdba.googlepages.com
 
________________________________

From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Jessica Richard
Sent: Wednesday, September 20, 2006 8:45 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] how to check the creation date of a postgres database?


\l and  \l+ show only the database name, owner and description.
select * from pg_database does not have date info, either.

I would like to know when each of my databases were created.

Thanks,
Jessica


________________________________

Get your own web address for just $1.99/1st yr
<http://us.rd.yahoo.com/evt=43290/*http://smallbusiness.yahoo.com/domain
s> . We'll help. Yahoo! Small Business
<http://us.rd.yahoo.com/evt=41244/*http://smallbusiness.yahoo.com/; . 

**********************************************************************
This message contains confidential information intended only for the use of the addressee(s) named above and may contain information that is legally privileged.  If you are not the addressee, or the person responsible for delivering it to the addressee, you are hereby notified that reading, disseminating, distributing or copying this message is strictly prohibited.  If you have received this message by mistake, please immediately notify us by replying to the message and delete the original message immediately thereafter.

Thank you.

                                   FADLD Tag
**********************************************************************

^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres database?
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
  2006-09-20 16:29 ` Re: how to check the creation date of a postgres Tomeh, Husam <htomeh@firstam.com>
@ 2006-09-20 16:58   ` Jessica Richard <rjessil@yahoo.com>
  2006-09-20 17:02     ` Re: how to check the creation date of a postgres database? Chris Mair <chrisnospam@1006.org>
  0 siblings, 1 reply; 13+ messages in thread

From: Jessica Richard @ 2006-09-20 16:58 UTC (permalink / raw)
  To: Tomeh, Husam <htomeh@firstam.com>; pgsql-admin

Thanks, but I still can't get the database creation date....


% cat PG_VERSION
8.1

16% ls -lt PG*
-rw-------    1 postgres users          4 Jun 22 10:34 PG_VERSION

This date was the date that the Postgres server was upgraded to 8.1 and the timestamp of this file is same under each of all database directories....




"Tomeh, Husam" <htomeh@firstam.com> wrote:      
 I don't  believe it's stored in the database. The closer you can get is to check the  date/timestamp of PG_VERSION file or possibly any file that may have an earlier  date/timestamp, under your database base subdirectory  ($PGDATA/base/your_database_oid/). For instance, for a database with OID of  34332 :
  
 ls  -lt  $PGDATA/base/34332/PG*
 
-rw-------  1 postgres postgres 4  Aug 24 10:41 PG_VERSION
  
 (Note that the PG_VERSION file in your $PGDATA data directory  signifies when the Postgres cluster was created, not a specific  database)
  
 --
    Husam
   http://firstdba.googlepages.com
  
  
---------------------------------
 From: pgsql-admin-owner@postgresql.org  [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Jessica  Richard
Sent: Wednesday, September 20, 2006 8:45 AM
To:  pgsql-admin@postgresql.org
Subject: [ADMIN] how to check the creation  date of a postgres database?


 
\l and  \l+ show only the database name, owner and  description.
select * from pg_database does not have date info,  either.

I would like to know when each of my databases were  created.

Thanks,
Jessica
  

---------------------------------
 Get your own web  address for just $1.99/1st yr. We'll help. Yahoo!  Small Business.  **********************************************************************
This  message contains confidential information intended only for the use of the  addressee(s) named above and may contain information that is legally  privileged.  If you are not the addressee, or the person responsible for  delivering it to the addressee, you are hereby notified that reading,  disseminating, distributing or copying this message is strictly  prohibited.  If you have received this message by mistake, please  immediately notify us by replying to the message and delete the original message  immediately thereafter.
 Thank you.
                                                                                                                           FADLD  Tag
**********************************************************************
 

 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail.

^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres database?
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
  2006-09-20 16:29 ` Re: how to check the creation date of a postgres Tomeh, Husam <htomeh@firstam.com>
  2006-09-20 16:58   ` Re: how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
@ 2006-09-20 17:02     ` Chris Mair <chrisnospam@1006.org>
  0 siblings, 0 replies; 13+ messages in thread

From: Chris Mair @ 2006-09-20 17:02 UTC (permalink / raw)
  To: Jessica Richard <rjessil@yahoo.com>; +Cc: pgsql-admin


> Thanks, but I still can't get the database creation date....
> 
> 
> % cat PG_VERSION
> 8.1
> 
> 16% ls -lt PG*
> -rw-------    1 postgres users          4 Jun 22 10:34 PG_VERSION
> 
> This date was the date that the Postgres server was upgraded to 8.1
> and the timestamp of this file is same under each of all database
> directories....

Ah, then the information was lost when you upgraded :/

Backups of the data files prior to the upgrade?

Bye, Chris.






^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres database?
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
@ 2006-09-22 02:52 ` Jim Nasby <jim@nasby.net>
  2006-09-22 14:30   ` Re: how to check the creation date of a postgres database? Tom Lane <tgl@sss.pgh.pa.us>
  2006-09-22 16:07   ` Re: how to check the creation date of a postgres database? Jim C. Nasby <jim@nasby.net>
  2 siblings, 2 replies; 13+ messages in thread

From: Jim Nasby @ 2006-09-22 02:52 UTC (permalink / raw)
  To: Jessica Richard <rjessil@yahoo.com>; +Cc: pgsql-admin

On Sep 20, 2006, at 11:45 AM, Jessica Richard wrote:
> \l and  \l+ show only the database name, owner and description.
> select * from pg_database does not have date info, either.
>
> I would like to know when each of my databases were created.

You're not the first person to ask for this, but it's still pretty  
unclear what the use-case for that info is (and without a decent use- 
case, it's pretty unlikely that this info will get stored).

So... why is it you want to know this?
--
Jim Nasby                                    jimn@enterprisedb.com
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)




--
Jim Nasby                                    jimn@enterprisedb.com
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)





^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres database?
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
  2006-09-22 02:52 ` Re: how to check the creation date of a postgres database? Jim Nasby <jim@nasby.net>
@ 2006-09-22 14:30   ` Tom Lane <tgl@sss.pgh.pa.us>
  2006-09-22 16:17     ` Re: how to check the creation date of a postgres database? Jim C. Nasby <jim@nasby.net>
  1 sibling, 1 reply; 13+ messages in thread

From: Tom Lane @ 2006-09-22 14:30 UTC (permalink / raw)
  To: Jim Nasby <jim@nasby.net>; +Cc: Jessica Richard <rjessil@yahoo.com>; pgsql-admin

Jim Nasby <jim@nasby.net> writes:
> On Sep 20, 2006, at 11:45 AM, Jessica Richard wrote:
>> I would like to know when each of my databases were created.

> You're not the first person to ask for this, but it's still pretty  
> unclear what the use-case for that info is (and without a decent use- 
> case, it's pretty unlikely that this info will get stored).

If we did store it, it would presumably reflect the time of issuance of
CREATE DATABASE, which would mean it wouldn't survive a dump and reload
anyway (as the OP seems to be wishing for).

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres database?
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
  2006-09-22 02:52 ` Re: how to check the creation date of a postgres database? Jim Nasby <jim@nasby.net>
  2006-09-22 14:30   ` Re: how to check the creation date of a postgres database? Tom Lane <tgl@sss.pgh.pa.us>
@ 2006-09-22 16:17     ` Jim C. Nasby <jim@nasby.net>
  2006-09-22 16:30       ` Re: how to check the creation date of a postgres database? Scott Marlowe <smarlowe@g2switchworks.com>
  0 siblings, 1 reply; 13+ messages in thread

From: Jim C. Nasby @ 2006-09-22 16:17 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Jessica Richard <rjessil@yahoo.com>; pgsql-admin

On Fri, Sep 22, 2006 at 10:30:55AM -0400, Tom Lane wrote:
> Jim Nasby <jim@nasby.net> writes:
> > On Sep 20, 2006, at 11:45 AM, Jessica Richard wrote:
> >> I would like to know when each of my databases were created.
> 
> > You're not the first person to ask for this, but it's still pretty  
> > unclear what the use-case for that info is (and without a decent use- 
> > case, it's pretty unlikely that this info will get stored).
> 
> If we did store it, it would presumably reflect the time of issuance of
> CREATE DATABASE, which would mean it wouldn't survive a dump and reload
> anyway (as the OP seems to be wishing for).

Well, that case could be handled as well, it's just a SMOC. But as I
mentioned, it's unlikely an existing developer will get excited about
any of this.
-- 
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres database?
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
  2006-09-22 02:52 ` Re: how to check the creation date of a postgres database? Jim Nasby <jim@nasby.net>
  2006-09-22 14:30   ` Re: how to check the creation date of a postgres database? Tom Lane <tgl@sss.pgh.pa.us>
  2006-09-22 16:17     ` Re: how to check the creation date of a postgres database? Jim C. Nasby <jim@nasby.net>
@ 2006-09-22 16:30       ` Scott Marlowe <smarlowe@g2switchworks.com>
  2006-09-22 16:34         ` Re: how to check the creation date of a postgres database? Jim C. Nasby <jim@nasby.net>
  0 siblings, 1 reply; 13+ messages in thread

From: Scott Marlowe @ 2006-09-22 16:30 UTC (permalink / raw)
  To: Jim C. Nasby <jim@nasby.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Jessica Richard <rjessil@yahoo.com>; pgsql-admin

On Fri, 2006-09-22 at 11:17, Jim C. Nasby wrote:
> On Fri, Sep 22, 2006 at 10:30:55AM -0400, Tom Lane wrote:
> > Jim Nasby <jim@nasby.net> writes:
> > > On Sep 20, 2006, at 11:45 AM, Jessica Richard wrote:
> > >> I would like to know when each of my databases were created.
> > 
> > > You're not the first person to ask for this, but it's still pretty  
> > > unclear what the use-case for that info is (and without a decent use- 
> > > case, it's pretty unlikely that this info will get stored).
> > 
> > If we did store it, it would presumably reflect the time of issuance of
> > CREATE DATABASE, which would mean it wouldn't survive a dump and reload
> > anyway (as the OP seems to be wishing for).
> 
> Well, that case could be handled as well, it's just a SMOC. But as I
> mentioned, it's unlikely an existing developer will get excited about
> any of this.

How about a default database comment on creation if the user doesn't set
one, of "database created 2006-09-21 12:34:56"



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres database?
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
  2006-09-22 02:52 ` Re: how to check the creation date of a postgres database? Jim Nasby <jim@nasby.net>
  2006-09-22 14:30   ` Re: how to check the creation date of a postgres database? Tom Lane <tgl@sss.pgh.pa.us>
  2006-09-22 16:17     ` Re: how to check the creation date of a postgres database? Jim C. Nasby <jim@nasby.net>
  2006-09-22 16:30       ` Re: how to check the creation date of a postgres database? Scott Marlowe <smarlowe@g2switchworks.com>
@ 2006-09-22 16:34         ` Jim C. Nasby <jim@nasby.net>
  0 siblings, 0 replies; 13+ messages in thread

From: Jim C. Nasby @ 2006-09-22 16:34 UTC (permalink / raw)
  To: Scott Marlowe <smarlowe@g2switchworks.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Jessica Richard <rjessil@yahoo.com>; pgsql-admin

On Fri, Sep 22, 2006 at 11:30:55AM -0500, Scott Marlowe wrote:
> On Fri, 2006-09-22 at 11:17, Jim C. Nasby wrote:
> > On Fri, Sep 22, 2006 at 10:30:55AM -0400, Tom Lane wrote:
> > > Jim Nasby <jim@nasby.net> writes:
> > > > On Sep 20, 2006, at 11:45 AM, Jessica Richard wrote:
> > > >> I would like to know when each of my databases were created.
> > > 
> > > > You're not the first person to ask for this, but it's still pretty  
> > > > unclear what the use-case for that info is (and without a decent use- 
> > > > case, it's pretty unlikely that this info will get stored).
> > > 
> > > If we did store it, it would presumably reflect the time of issuance of
> > > CREATE DATABASE, which would mean it wouldn't survive a dump and reload
> > > anyway (as the OP seems to be wishing for).
> > 
> > Well, that case could be handled as well, it's just a SMOC. But as I
> > mentioned, it's unlikely an existing developer will get excited about
> > any of this.
> 
> How about a default database comment on creation if the user doesn't set
> one, of "database created 2006-09-21 12:34:56"
 
If we had catalog triggers, one could do that automagically...
-- 
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: how to check the creation date of a postgres database?
  2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
  2006-09-22 02:52 ` Re: how to check the creation date of a postgres database? Jim Nasby <jim@nasby.net>
@ 2006-09-22 16:07   ` Jim C. Nasby <jim@nasby.net>
  1 sibling, 0 replies; 13+ messages in thread

From: Jim C. Nasby @ 2006-09-22 16:07 UTC (permalink / raw)
  To: Jessica Richard <rjessil@yahoo.com>; +Cc: pgsql-admin

Please include the list in your replies.

On Fri, Sep 22, 2006 at 09:04:08AM -0700, Jessica Richard wrote:
> Thanks for your reply.
> 
> It is for database documentation.
 
Is it really that important to know when a database was created?

I'm doubtful that anyone in the community will get excited enough to
make a patch based just on that use case; though if you were to create
one it might get accepted.

> Jim Nasby <jim@nasby.net> wrote: On Sep 20, 2006, at 11:45 AM, Jessica Richard wrote:
> > \l and  \l+ show only the database name, owner and description.
> > select * from pg_database does not have date info, either.
> >
> > I would like to know when each of my databases were created.
> 
> You're not the first person to ask for this, but it's still pretty  
> unclear what the use-case for that info is (and without a decent use- 
> case, it's pretty unlikely that this info will get stored).
> 
> So... why is it you want to know this?
-- 
Jim C. Nasby, Database Architect                   jim@nasby.net
512.569.9461 (cell)                         http://jim.nasby.net



^ permalink  raw  reply  [nested|flat] 13+ messages in thread


end of thread, other threads:[~2006-09-22 16:34 UTC | newest]

Thread overview: 13+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-09-20 15:45 how to check the creation date of a postgres database? Jessica Richard <rjessil@yahoo.com>
2006-09-20 16:07 ` Chris Mair <chrisnospam@1006.org>
2006-09-20 16:52   ` Jessica Richard <rjessil@yahoo.com>
2006-09-20 17:00     ` Chris Mair <chrisnospam@1006.org>
2006-09-20 16:29 ` Re: how to check the creation date of a postgres Tomeh, Husam <htomeh@firstam.com>
2006-09-20 16:58   ` Jessica Richard <rjessil@yahoo.com>
2006-09-20 17:02     ` Chris Mair <chrisnospam@1006.org>
2006-09-22 02:52 ` Jim Nasby <jim@nasby.net>
2006-09-22 14:30   ` Tom Lane <tgl@sss.pgh.pa.us>
2006-09-22 16:17     ` Jim C. Nasby <jim@nasby.net>
2006-09-22 16:30       ` Scott Marlowe <smarlowe@g2switchworks.com>
2006-09-22 16:34         ` Jim C. Nasby <jim@nasby.net>
2006-09-22 16:07   ` Jim C. Nasby <jim@nasby.net>

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