Chapter 08 · Clickhouse Managed Postgres Rca
Subchapter 8.6
rules/heuristic-write-congestion.mdMarkdown3 KBView on GitHub
Use when the triage decision tree pointed here: top
patterns have <db_operation> of INSERT/UPDATE/DELETE with
large <total_wal_bytes>, or the user reports symptoms
(timeouts, retries) that this skill’s per-pattern view alone
can’t confirm.
This is the one heuristic that may need the opt-in second
Prom scrape (see prometheus-scrape.md) — specifically to
get a non-zero delta on PostgresServer_Deadlocks_Total and a
rollback/commit ratio from
PostgresServer_TransactionsRolledBack_Total vs
_Committed_Total. Neither is exposed in Slow Query Patterns.
Field names reference roles from your session’s role map
(per openapi-discovery.md).
Three sub-patterns live under “write congestion.” Distinguish before recommending.
PostgresServer_Deadlocks_Total delta > 0 over the window.
At least two concurrent transactions are taking locks in
incompatible orders.
Recommend:
deadlock detected entries — these log
the exact statements involved, which the API doesn’t.One write pattern with high <avg_duration>. Could be a wide
row insert under contention, a large update touching many
rows, or WAL congestion under heavy concurrent writes.
Recommend:
<total_rows> per call): batch into
smaller chunks with explicit transactions, so each chunk
commits separately.<total_wal_bytes>.
If high, the bottleneck is WAL flush — the user may need to
tune commit_delay / synchronous_commit (with durability
tradeoffs the user must own) or scale the instance.<error_count> is unusually large relative to <call_count>,
or PostgresServer_TransactionsRolledBack_Total delta is high
relative to commits.
Recommend:
SERIALIZABLE /
REPEATABLE READ isolation.