when was a db/schema created ?

Started by Gauthier, Daveover 13 years ago3 messagesgeneral
Jump to latest
#1Gauthier, Dave
dave.gauthier@intel.com

Is there a way to determine when a DB was created (create database...)?
Thanks in advance.

#2Fabrízio de Royes Mello
fabriziomello@gmail.com
In reply to: Gauthier, Dave (#1)
Re: when was a db/schema created ?

2012/9/17 Gauthier, Dave <dave.gauthier@intel.com>

Is there a way to determine when a DB was created (create database...)?**
**

Thanks in advance.****

Dear Dave,

You can configure the "log_statement" [1]http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html#GUC-LOG-STATEMENT GUC to log DDL statements.

Regards,

[1]: http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html#GUC-LOG-STATEMENT
http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html#GUC-LOG-STATEMENT

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL

Show quoted text

Blog sobre TI: http://fabriziomello.blogspot.com
Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
Twitter: http://twitter.com/fabriziomello

#3Josh Kupershmidt
schmiddy@gmail.com
In reply to: Gauthier, Dave (#1)
Re: when was a db/schema created ?

On Mon, Sep 17, 2012 at 2:16 PM, Gauthier, Dave <dave.gauthier@intel.com> wrote:

Is there a way to determine when a DB was created (create database...)?

If you don't have the CREATE DATABASE statement in your logs, you could try

SELECT oid FROM pg_database WHERE datname = 'name of your database';

Then check the creation time of the directory with that OID in your
$PGDATA directory, under ./base/.

Josh