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
Copy file name to clipboardExpand all lines: internal/db/POOL_NOTES.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,14 @@ closes the pool on graceful shutdown.
55
55
request rather than a process-wide stall.
56
56
- No secrets are logged; the DSN is never printed (only wrapped error text).
57
57
58
+
## Hedged reads for replica tail latency
59
+
60
+
The read router now supports optional hedged reads for read-only SELECT statements routed to a replica. When the first replica request remains in flight past a configured delay, the router starts a second replica attempt and returns the first successful result while canceling the losing request. This keeps the normal read path efficient and limits extra work to slow-tail cases only.
61
+
62
+
- The behavior is gated to read-only SELECTs so writes and non-SELECT reads remain on the primary path.
63
+
- The helper exposes the metric `hedged_reads_total{winner}` to observe which hedge attempt won.
64
+
- Context cancellation is propagated to both in-flight attempts so the losing query does not continue to consume replica CPU.
0 commit comments