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
{{ message }}
Repository navigation
Commit 356af94
Browse filesBrowse the repository at this point in the historyBrowse files
perf: send the publish NOTIFY in the INSERT's RETURNING (#235)
* perf: send the publish NOTIFY in the INSERT's RETURNING
* test: accept the uncast pg_notify bind that SQLAlchemy 2.0.0 renders
* ci: measure coverage with sys.monitoring
Copy file name to clipboardExpand all lines: docs/concepts/performance.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,16 +45,18 @@ why).
45
45
| Need more parallel handler capacity |`max_workers` / `fetch_batch_size`| More concurrency, but mind the [connection budget](../usage/subscriber.md#connection-budget). |
46
46
47
47
Single-publish-per-transaction workloads see no change from NOTIFY dedup (one row
48
-
still emits one NOTIFY), and the batched-flush win is largest at low `max_workers`
48
+
still emits one NOTIFY), but that NOTIFY rides in the INSERT's `RETURNING`, so it
49
+
adds no round trip of its own. The batched-flush win is largest at low `max_workers`
49
50
(where per-row deletes serialise) and narrows as worker parallelism rises.
50
51
51
52
## The three levers
52
53
53
54
### Producer: NOTIFY dedup (automatic)
54
55
55
56
`broker.publish` / `publish_batch` emit one `pg_notify` per (transaction,
56
-
queue), so N publishes to the same queue in one transaction cost one NOTIFY
57
-
round-trip. Postgres already coalesces identical notifications per transaction
57
+
queue), so N publishes to the same queue in one transaction cost at most one
58
+
NOTIFY. A single `publish` puts it in the INSERT's `RETURNING`, so it costs no
59
+
round trip; `publish_batch` sends it as one extra statement. Postgres already coalesces identical notifications per transaction
58
60
at delivery, so extra NOTIFYs would be pure waste. It is default-on, has no knob, and is
59
61
behavior-preserving: the subscriber still gets its wake, fired inline at the first
0 commit comments