pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Tim Landscheidt <tim@tim-landscheidt.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: mail alert
Date: Thu, 13 Aug 2009 18:36:00 -0400
Message-ID: <20090813223600.GW5909@alvh.no-ip.org> (raw)
In-Reply-To: <m3bpmjfj3s.fsf@passepartout.tim-landscheidt.de>
References: <E30C7040DE22624185BAD4093190B54437BE5DB49C@EX2007-MBX-2.uz.kuleuven.ac.be>
	<EC8A0653E149420D898593D05B1E07FF@ramasubramanian>
	<E30C7040DE22624185BAD4093190B54437BE5DB4A9@EX2007-MBX-2.uz.kuleuven.ac.be>
	<h6106l$h8t$2@reversiblemaps.ath.cx>
	<20090813215420.GU5909@alvh.no-ip.org>
	<m3bpmjfj3s.fsf@passepartout.tim-landscheidt.de>

Tim Landscheidt wrote:

> The main disadvantage in using a listener is that it is your
> responsibility to make sure that the listener is listening
> 24/7 - from before the database accepts other connections,
> through network failures, bugs, etc. - otherwise notifica-
> tions will be lost. Therefore I find it much more reliable
> (and easier to program) to copy the relevant data to a table
> "mailqueue" (or whatever) and then process that queue every
> other minute.

You just have to make sure the listener scans the table for possible
events that were missed.  Think of notifications as signals to wake up
and check for possible work, not data carriers.  The mailqueue table
should still be there for the data.  The only difference between your
approach and mine is that you poll every minute instead of sleeping
until getting a notification.  If your system is going to be receiving
notifications fairly frequently, it is probably better to stay with
polling.  (This is what Skype's replication system does, and Hannu
Krossing says "what, are you going to optimize for the time when the
server is idle?")

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



view thread (16+ messages)  latest in thread

Message-ID: <20090813223600.GW5909@alvh.no-ip.org>
Permalink:  ../20090813223600.GW5909@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20090813223600.GW5909@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alvherre@commandprompt.com, tim@tim-landscheidt.de
  Subject: Re: mail alert
  In-Reply-To: <20090813223600.GW5909@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox