[GENERAL]register creation date of table - Mailing list pgsql-hackers

From Willy-Bas Loos
Subject [GENERAL]register creation date of table
Date
Msg-id CAHnozTg4=j_F0ON4B7CmVwtjL-Jq4SOauDD5h93+fX4=OwdUBA@mail.gmail.com
Whole thread Raw
Responses Re: [GENERAL]register creation date of table  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi,

We have several users working on a 8.4 database, using it as a
back-end for several related apps and transfering data to and from it.
The database tends to get a bit messy, so i've made a little table to
provide an overview.
This table is truncated and refilled daily, it shows all tables and
views in the database and :
* the owner
* number of records (estimation)
* it's size on disk
* the description

There's a view on the table that shows the size as pg_size_pretty
When you edit the description in the table (or the view, but no
support in pgAdmin), the comment in the system tables is updated also.
I attatched my code, hope some people find it handy, sorry for the
names and comments being in dutch.

Now, i would like to improve this thing and add a creation date for the table.
I have some questions about that.
1. I think that there is no such information in the system tables. is
that correct?
I am planning to change the mechanism, so that the table is not
truncated, but new tables are inserted in the overview and dropped
tables are deleted from it. I need to do that in 2 steps (delete and
insert).
Then i can add a creation-date column which i will fill with 'today'.

2. i would like to go back in time. I think that i will just look up
the creation date for the files in the data directory and translate
their oid's to the object names and then update their dates. This
would of course only work from the last restore. Is that a good way to
do it?

Thanks,

WBL

--
"Patriotism is the conviction that your country is superior to all
others because you were born in it." -- George Bernard Shaw

Attachment

pgsql-hackers by date:

Previous
From: Cédric Villemain
Date:
Subject: Re: patch for new feature: Buffer Cache Hibernation
Next
From: Heikki Linnakangas
Date:
Subject: Re: patch for new feature: Buffer Cache Hibernation