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

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: John DeSoi <desoi(at)pgedit(dot)com>
Cc: Evan Martin <postgresql2(at)realityexists(dot)net>, "pgsql-general(at)postgresql(dot)org general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Way to quickly detect if database tables/columns/etc. were modified?
Date: 2016-10-31 13:14:07
Message-ID: CANu8FixQ5pgxE9OFUcVrstNetRzp9FpjRo-7pKxUiAZV62_poA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 31, 2016 at 8:54 AM, John DeSoi <desoi(at)pgedit(dot)com> wrote:

>
> > On Oct 30, 2016, at 4:45 AM, Evan Martin <postgresql2(at)realityexists(dot)net>
> wrote:
> >
> > If I have a query that reads from system tables like pg_class,
> pg_namespace, pg_attribute, pg_type, etc. and I'd like to cache the results
> in my application is there any fast way to detect when any changes have
> been made to these system catalogs? I don't need to know exactly what has
> changed. Some kind of a global "database version" would do, just so I know
> that I need to invalidate my cache (the database definition is rarely
> modified in practice).
>
> Maybe create an event trigger that updates a simple table with the last
> modification time or sends a notification?
>
> https://www.postgresql.org/docs/current/static/sql-createeventtrigger.html
>
> John DeSoi, Ph.D.
>
>
>
> --
> 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
>

*>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.*--
*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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2016-10-31 13:19:15 Re: How to hint 2 coulms IS NOT DISTINCT FROM each other
Previous Message John DeSoi 2016-10-31 12:54:36 Re: Way to quickly detect if database tables/columns/etc. were modified?