Re: Way to quickly detect if database tables/columns/etc. were modified?

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Way to quickly detect if database tables/columns/etc. were modified?
Date: 2016-10-31 14:31:38
Message-ID: CAEfWYyyCsvs2SThxRt1COd77c6q3-ZuMfG3OJ8zVeh_DUraR=g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Not sure if it would work for your use-case but what about just monitoring
the PostgreSQL log for DDL statements? You may have to filter out temp
tables (as you might in the system catalogs as well) but you could probably
also watch for specific tablename patterns in case you only need to
invalidate cache under specific circumstances.

Cheers,
Steve

On Mon, Oct 31, 2016 at 7:17 AM, Melvin Davidson <melvin6925(at)gmail(dot)com>
wrote:

>
>
> On Mon, Oct 31, 2016 at 9:48 AM, Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
> wrote:
>
>> On Mon, Oct 31, 2016 at 09:14:07AM -0400, Melvin Davidson wrote:
>>
>> >> Maybe create an event trigger that updates a simple table with the last
>> >> modification time or sends a notification?
>> ...
>> > That would certainly work, but
>> > the problem is, that trigger would have to be created for every table in
>> > the database. When you have more than a couple dozen tables, as in
>> > hundreds, it becsmes a huge undertaking.*--
>>
>> Well, it could be generated.
>>
>> Karsten
>> --
>> GPG key ID E4071346 @ eu.pool.sks-keyservers.net
>> E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>
> >Well, it could be generated.
> True, but it still is more code to maintain, whereas I maintain the
> addition addition of one column in pg_class and pg_attribute with a default
> of now()
> would make more sense. That being said, there were so many naysayers
> grasping at corner cases the last time I brought this up I have given up
> pursuing it.
>
> --
> *Melvin Davidson*
> I reserve the right to fantasize. Whether or not you
> wish to share my fantasy is entirely up to you.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2016-10-31 14:45:01 Re: Rows are repeating by the trigger function
Previous Message Adrian Klaver 2016-10-31 14:29:43 Re: Way to quickly detect if database tables/columns/etc. were modified?