Thread: Asynchronos notifications to clients on table changes

Asynchronos notifications to clients on table changes

From
Vincent AE Scott
Date:
What would be a reliable way for a client accessing postgres to be
informed asynchronosly of inserts/updates/deletes to a table?  I'm
thinking of something that has fairly fine grained control over what it
gets notified of.  Something like a client registering (somewhere) a
select statement, and when a matching row changes to be informed about
it.

I guess this would require some external program, and possibly
programmed trigger modules in the database?

Is this even theoretically possible?  Or would the overhead under heavy
loads completely kill the database?


--

PGP key:  http://codex.net/pgp/pgp.asc

Re: Asynchronos notifications to clients on table changes

From
Jason Earl
Date:
Check out the NOTIFY and LISTEN commands.  I usually create a small
function that fires off a notify on INSERT DELETE or UPDATE and then I
simply have my application LISTEN for these notifies.

No external program necessary.

Jason

Vincent AE Scott <pgsql-novice@codex.net> writes:

> What would be a reliable way for a client accessing postgres to be
> informed asynchronosly of inserts/updates/deletes to a table?  I'm
> thinking of something that has fairly fine grained control over what it
> gets notified of.  Something like a client registering (somewhere) a
> select statement, and when a matching row changes to be informed about
> it.
>
> I guess this would require some external program, and possibly
> programmed trigger modules in the database?
>
> Is this even theoretically possible?  Or would the overhead under heavy
> loads completely kill the database?
>
>
> --
>
> PGP key:  http://codex.net/pgp/pgp.asc
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org