Re: notification payloads - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: notification payloads
Date
Msg-id 1174976597.3701.7.camel@localhost.localdomain
Whole thread Raw
In response to Re: notification payloads  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: notification payloads
List pgsql-hackers
Ühel kenal päeval, E, 2007-03-26 kell 14:07, kirjutas Tom Lane:
> Alvaro Herrera <alvherre@commandprompt.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




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: notification payloads
Next
From: "Marko Kreen"
Date:
Subject: Re: BSD advertizing clause in some files