I'm building Corfedo Work , a .NET library for background jobs that keeps its state in the application's own PostgreSQL database. Its workers need to know when something changed: a job became due, or a job somebody is waiting for has ended. The PostgreSQL answer is NOTIFY in the transaction that made the change. I designed the library's signals around it.
Then I measured it. Single-row transactions with a NOTIFY committed about 3,900 times per second with 8 clients, and about 3,900 with 64. Without the NOTIFY , the same transactions reached 16,700 and 56,700.
Signals that ride the transaction
A signal in Work says "something you wait for may have changed, read again". It's a topic and a key, with no data. The application sends it in the same transaction as the change:
static readonly SignalTopic Pending = new ( "orders.pending" );
await using var tx = await db . Database . BeginTransactionAsync ( ct ); db . Orders . Add ( order ); await db . SaveChangesAsync ( ct ); await signals . SendAsync ( db .…