You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NOTIFY/LISTEN doesn't work with Transaction Pooling, only with Session Pooling
NOTIFY/LISTEN is quite useful for SIGNALLING (not for queued data), so a NOTIFIED process knows to Query again (instead of polling on an interval).
I would like to use just PostgreSQL and not have to add more infrastructure
Inadequate workarounds
Session Mode doesn't scale. If there are 1000x pgbouncer clients there needs to be 1000x PostgreSQL connections (no pooling).
If other infrastructure is used, there needs to be a connection-per-client maintained anyway, and when SIGNALLED there will be a maximum of 2x Connections per client (one for PosgreSQL and one for some other Signalling system)
Some PostgreSQL installations don't have integration with other infrastructure. That is, if you planned to call NOTIFY in a trigger, there may be no alternative when using other infrastructure (with limitations from the IaaS provider).
Solution
Maintain a single [Listen Connection] to the PostgreSQL server
Isolate LISTEN commands from connections in Transaction Pooling mode
Read the LISTEN command and map it against the PGBounce TCP connection - using a simple PUB/SUB mechanism
Send each distinct LISTEN command onward to the [Listen Connection] instead
Upon NOTIFY from the [Listen Connection] convert to an internal PUB message and distribute to subscribers (forwarding the original NOTIFY message).
Resourcing
Does PGBouncer have a bounty/donation system? I will pay for this, or have my team build it
Problem
Inadequate workarounds
NOTIFYin a trigger, there may be no alternative when using other infrastructure (with limitations from the IaaS provider).Solution
Resourcing