Listen/notify in Postgres is a powerful feature missing in other databases like MySQL and SQLite. Despite its simplicity, many applications using it inefficiently, consuming Postgres connections. Enter the notifier pattern, which allows a single connection per program to handle multiple topic subscriptions. With implementations like River’s notifier in Go, subscriptions are organized efficiently, ensuring timely message processing and test reliability. Additionally, the notifier’s health monitoring feature allows for reactive maintenance or embraces a “let it crash” approach to ensure program robustness. Using PgBouncer with session pooling maximizes connection efficiency, making listen/notify usage more effective.
https://brandur.org/notifier