Re: user get notification when postgresql database updated

From: Tom Molesworth <tom(at)audioboundary(dot)com>
To: Albert <oo_O2_oo(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: user get notification when postgresql database updated
Date: 2012-03-28 12:14:05
Message-ID: 4F73008D.5050103@audioboundary.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vikash3 S 2012-03-28 12:57:30 Query regarding submission on To Do item for psql client "psql : Allow processing of multiple -f (file) options "
Previous Message Albert 2012-03-28 11:40:42 user get notification when postgresql database updated