Re: Why is there no object create date is the catalogs?
| От | Adrian Klaver |
|---|---|
| Тема | Re: Why is there no object create date is the catalogs? |
| Дата | |
| Msg-id | 55527655.7080908@aklaver.com обсуждение исходный текст |
| Ответ на | Why is there no object create date is the catalogs? (Melvin Davidson <melvin6925@gmail.com>) |
| Список | pgsql-general |
On 05/12/2015 12:51 PM, Melvin Davidson wrote: > > Can anyone tell me why there is no "relcreated" column in pg_class to > track the creation date of an object? So what date would it track?: 1) The date in the original database? 2) The date the table was restored to another database cluster? 3) The date it was replicated to a standby? 4) The date it went through a DROP TABLE IF EXISTS some_table, CREATE TABLE some_table cycle? I could go on. I imagine that most people that want to track that sort of thing keep their schema definitions under version control and keep track of the dates there. > > It seems to me it would make sense to have one as it would facilitate > auditing of when objects are created. In addition, it would also > facilitate the dropping of objects that have exceeded a certain age. Now, that just scares me:) That is often handled through partitioning: www.postgresql.org/docs/9.4/static/ddl-partitioning.html Otherwise I am not sure how an object being past a certain date equates to dropping it? > > EG: SELECT 'DELETE TABLE ' || relname || ';' > FROM pg_class > WHERE relkind = 'r' > AND relcreated > current_timestamp - INTERVAL ' 1 year'; > > Adding that column should be relatively easy and would not break > backwards compatiblity with previous versions. > -- > *Melvin Davidson* -- Adrian Klaver adrian.klaver@aklaver.com
В списке pgsql-general по дате отправления: