Re: How to find table creation time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry Guys i responded earlier but only to Guillaume for some unexplained reason:/ Anyways steve suggested what I was going to suggest. I think its a great advice going forward. 


That is crazy that creation time is not logged anywhere. 

One thing to note, you can log ddl changes in postgres. Some would argue this should be on by default and i would agree. 

In the postgres.conf>>

log_statement = ddl

Moving forward that will give you the creation time of tables. Although I know your objective may have been to go back in time:)  Anyways I actually parse the logs out and have an email sent to me if a DDL statement happens. Its a nice way to keep a pulse on schema changes or to catch someone “sneaking in” a change. Or even think about data recovery, “what time did you drop that production table?” is no longer a question. 

hopefully that can help!

-jason 



That is crazy that creation time is not logged anywhere. 

One thing to note, you can log ddl changes in postgres. Some would argue this should be on by default and i would agree. 

In the postgres.conf>>

log_statement = ddl

Moving forward that will give you the creation time of tables. Although I know your objective may have been to go back in time:)  Anyways I actually parse the logs out and have an email sent to me if a DDL statement happens. Its a nice way to keep a pulse on schema changes or to catch someone “sneaking in” a change. Or even think about data recovery, “what time did you drop that production table?” is no longer a question. 

hopefully that can help!

-jason 






On April 7, 2014 at 11:04:21 AM, Steve Crawford (scrawford@xxxxxxxxxxxxxxxxxxxx) wrote:

On 04/04/2014 04:39 PM, Nik Tek wrote:
> Hi,
>
> Is there a way to find table creation time in postgres?
> pg version is 9.0
>
Not by some baked-in command but you can determine it from the logs if
you have the appropriate log-settings and sufficient log-retention.

Cheers,
Steve



--
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

This transmission contains confidential and privileged information intended solely for the party identified above. If you receive this message in error, you must not use it or convey it to others. Please destroy it immediately and contact the sender at (303) 386-3955 or by return e-mail to the sender.


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux