Re: Sending notifications from the master to the standby

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Sending notifications from the master to the standby
Date: 2012-01-11 23:38:08
Message-ID: 29168.1326325088@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Josh Berkus <josh(at)agliodbs(dot)com> writes:
>> BTW ... it occurs to me to ask whether we really have a solid use-case
>> for having listeners attached to slave servers. I have personally never
>> seen an application for LISTEN/NOTIFY in which the listeners were
>> entirely read-only. Even if there are one or two cases out there, it's
>> not clear to me that supporting it is worth the extra complexity that
>> seems to be needed.

> The basic idea is that if we can replicate LISTENs, then you can use
> replication as a simple distributed (and lossy) queueing system.

Well, this is exactly what I don't believe. A queueing system requires
that recipients be able to remove things from the queue. You can't do
that on a slave server, because you can't make any change in the
database that would be visible to other users.

> The obvious first use case for this is for cache invalidation.

Yeah, upthread Simon pointed out that propagating notifies would be
useful for flushing caches in applications that watch the database in a
read-only fashion. I grant that such a use-case is technically possible
within the limitations of a slave server; I'm just dubious that it's a
sufficiently attractive use-case to justify the complexity and future
maintenance costs of the sort of designs we are talking about. Or in
other words: so far, cache invalidation is not the "first" use-case,
it's the ONLY POSSIBLE use-case. That's not useful enough.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2012-01-11 23:51:18 Re: Sending notifications from the master to the standby
Previous Message Kevin Grittner 2012-01-11 23:32:59 Remembering bug #6123