Cache invalidation notification (was: Database Caching) - Mailing list pgsql-hackers

From Hannu Krosing
Subject Cache invalidation notification (was: Database Caching)
Date
Msg-id 1015314331.1933.25.camel@taru.tm.ee
Whole thread Raw
In response to Re: Database Caching  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, 2002-03-04 at 23:50, Tom Lane wrote:
> "Rod Taylor" <rbt@zort.ca> writes:
> > Rather than result caching, I'd much rather see an asynchronous NOTICE
> > telling my webservers which have RULES firing them off when a table is
> > modified.
> 
> LISTEN/NOTIFY?

But is there an easy way to see which tables affect the query result,
something like machine-readable EXPLAIN ?

Another thing that I have thought about Is adding a parameter to notify,
so that you can be told _what_ is changed (there is big difference
between being told that "somebody called" and "Bob called")

There are two ways of doing it 

1) the "wire protocol compatible" way , where the argument to LISTEN is
interpreted as a regular expression (or LIKE expression), so that you
can do

LISTEN 'ITEM_INVALID:%';

and the receive all notifies for

NOTIFY 'ITEM_INVALID:' || ITEM_ID;

and

NOTIFY 'ITEM_INVALID:ALL';

where the notify comes in as one string

2) the more general way where you listen on exact "relation" and notify
has an argument at both syntax and protocol level, i.e

LISTEN ITEM_INVALID;

and

NOTIFY 'ITEM_INVALID',ITEM_ID;

NOTIFY 'ITEM_INVALID','ALL';

------------------
Hannu




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Storage Location Patch Proposal for V7.3
Next
From: Bruce Momjian
Date:
Subject: Re: Storage Location Patch Proposal for V7.3