Postgres LISTEN/NOTIFY actually scales
Postgres LISTEN/NOTIFY has a bad reputation thanks in part to a popular blog post asserting it does not scale. If that were true, it would be a shame, because LISTEN/NOTIFY is a powerful tool, allowing you to use your Postgres database for low-latency durable notifications, streams, and pub/sub. The accusations aren’t wrong: NOTIFY has unintuitive and undocumented performance characteristics arising from its use of a global lock.
- ▪Postgres LISTEN/NOTIFY has a bad reputation thanks in part to a popular blog post asserting it does not scale.
- ▪If that were true, it would be a shame, because LISTEN/NOTIFY is a powerful tool, allowing you to use your Postgres database for low-latency durable notifications, streams, and pub/sub.
- ▪The accusations aren’t wrong: NOTIFY has unintuitive and undocumented performance characteristics arising from its use of a global lock.
Hacker News (Front Page) files mainly under programming. We currently carry 550 of its stories. Top-voted stories on Hacker News.
Opening excerpt (first ~120 words) tap to expand
Postgres LISTEN/NOTIFY has a bad reputation thanks in part to a popular blog post asserting it does not scale. If that were true, it would be a shame, because LISTEN/NOTIFY is a powerful tool, allowing you to use your Postgres database for low-latency durable notifications, streams, and pub/sub. The accusations aren’t wrong: NOTIFY has unintuitive and undocumented performance characteristics arising from its use of a global lock. But “unintuitive behavior” is not the same as “not scalable.” In this blog post, we’ll show how we optimized LISTEN/NOTIFY-backed streams at scale, achieving 60K writes per second on a single Postgres server with millisecond-scale latency.Low-Latency Streaming with LISTEN/NOTIFYThe basic design of Postgres-backed streams is simple: create a streams table where…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Dbos.