Re: Data in table changed?

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Thomas Holmgren <thm(at)regnecentralen(dot)dk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Data in table changed?
Date: 2004-03-02 14:39:21
Message-ID: 20040302083921.A31279@mofo.meme.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 2004.03.02 08:04 Thomas Holmgren wrote:

I need an efficient way of determining if data in
> a
> table has been changed (either updated, deleted or inserted). Can this
> be achieved without scanning the tables using expensive SQL? (my
> tables
> are _big_!) Is there some way to get a "time for last update" for a
> specific table? Or something similar I can use?

You could always make table of 'last changed' timestamps with
columns of tablename and timestamp. Then a function which takes
the name of the table and updates the last_changed table with
a timestamp is called from a trigger for insert, update, and
delete of each table. The CREATE TRIGGER would pass the name
of the table to the function.

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alan Carbutt 2004-03-02 14:59:07 max table size
Previous Message Shridhar Daithankar 2004-03-02 14:28:40 Re: Data in table changed?