Re: user get notification when postgresql database updated - Mailing list pgsql-general

From Tom Molesworth
Subject Re: user get notification when postgresql database updated
Date
Msg-id 4F73008D.5050103@audioboundary.com
Whole thread Raw
In response to user get notification when postgresql database updated  (Albert <oo_O2_oo@hotmail.com>)
List pgsql-general
On 28/03/12 12:40, Albert wrote:
> I am using javaScript app and PostgreSQL database. I have car_alert as a
> table contains id (FK of cars table) and userid (FK of users table)
> each car has a status ( status column in cars table ).
>
> car_alert is updating and having new records (car id and userid ) every time
> user choose car to be alerted about.
>
> my database information is updating every 10 min and the user should get
> notification message every time status for its car is changed. ( of course
> every user has choosed his interested cars and inserted them to the
> car_alert table by car id ) .
>
> what is the best method to do that ?
>

Depends on what you mean by "javaScript app" in this context -
browser-based or standalone? If the latter, the NOTIFY/LISTEN mechanism
may help, see http://www.postgresql.org/docs/9.1/static/sql-notify.html,
and if it's in the browser, might as well just poll the server every 10
minutes, that's unlikely to put much load on the server or network and
there's not much point doing it more often if the updates only happen
every 10 minutes anyway.

cheers,

Tom


pgsql-general by date:

Previous
From: Albert
Date:
Subject: user get notification when postgresql database updated
Next
From: "Albe Laurenz"
Date:
Subject: Re: Multiple Slave Failover with PITR