Re: notification payloads

From: Hannu Krosing <hannu(at)skype(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Dave Page <dpage(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: notification payloads
Date: 2007-03-27 06:23:17
Message-ID: 1174976597.3701.7.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ühel kenal päeval, E, 2007-03-26 kell 14:07, kirjutas Tom Lane:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > Why have the name on each message? Presumably names are going to be few
> > compared to the total number of messages, so maybe store the names in a
> > separate hash table and link them with a numeric identifier. That gives
> > you room for a lot more messages.
>
> That can be done by the application, if its notify payloads are such
> that that's a useful optimization. However it seems entirely possible
> to me that the payload strings might be nonrepeating and the overhead
> of a separate table completely wasted.

What we could do is use one name for many messages/listeners/notifies,
so that in case we have 10 backends listening to "ACCOUNTS_CHANGE', then
we can keep the ACCOUNTS_CHANGE part only once, and reuse it's id also
for LISTENs.

That would get the same storage savings as Alvaros proposed hash and
only be live during the time whenthere are any listeners.

So perhaps it Alvaros proposal can be rephrased thus:
"Why have the name on each message? The names are already stored in
listen table, just reuse numeric identifier pointing to item in that
table. That gives you room for a lot more messages."

If there is no name in listen table, it means that nobody is interested
and the message can be dropped right away.

> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
--
----------------
Hannu Krosing
Database Architect
Skype Technologies OÜ
Akadeemia tee 21 F, Tallinn, 12618, Estonia

Skype me: callto:hkrosing
Get Skype for free: http://www.skype.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Kreen 2007-03-27 07:57:13 Re: BSD advertizing clause in some files
Previous Message Tom Lane 2007-03-27 04:21:33 Re: notification payloads