Re: Last modification time of a database?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Erik Jones <ejones(at)engineyard(dot)com>
Cc: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, General postgres mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Last modification time of a database?
Date: 2009-03-25 00:47:39
Message-ID: 13630.1237942059@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Erik Jones <ejones(at)engineyard(dot)com> writes:
> These are all client databases at the web hosting company I work at.
> I can't go putting triggers on all of their tables. I think I'll just
> start taking snapshots of pertinent data from pg_stat_activity and
> after I've been collecting data for a while run a report of dbs that
> haven't seen connections in X long since what I'm really after is
> inactive databases.

It seems like a pretty low-precision result would be sufficient for what
you need. Have you tried just tracking the last file mod time within
each database directory? This would be later than the real last use
due to delayed vacuum, etc, but it might be good enough.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message berdam 2009-03-25 02:02:15 Re: Res: Case sensitivity problems with user name
Previous Message Erik Jones 2009-03-24 23:24:50 Re: Last modification time of a database?