Erik Jones <ejones@engineyard.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