Problem
fresh/docker/docker-compose.yml doesn't set random_page_cost or effective_io_concurrency, so postgres falls through to PostgreSQL defaults of 4.0 and 1 — both calibrated for spinning rust. All NewGraph hosts run on SSD (M4 NVMe, M1 Colima virtiofs over APFS, cypher DO block storage). With random_page_cost=4, the planner systematically biases away from index scans for segment-keyed lookups in link's pipeline (WHERE blue_line_key = … AND drm <= … against streams_breaks is the hot path).
Verified on M4 + M1 + cypher today (2026-05-04) — all three show random_page_cost=4, effective_io_concurrency=1, temp_buffers=8MB.
Proposed
Add to the db.command block in base docker-compose.yml:
-c random_page_cost=1.1
-c effective_io_concurrency=200
-c temp_buffers=64MB
Document in fresh/docker/tuning.md alongside the existing memory rationale: SSD cost values, why they matter for link's segment-heavy SQL.
Verification
Settings applied locally on M4 (2026-05-04, post-issue-filing) and the change is correctness-driven (planner cost matches actual hardware), not solely performance-driven. ADMS warm-cache wall: 126 s post-tuning vs 129.5 s pre-tuning (M4 morning provincial run) — within ~3 % noise. M4 (Apple Silicon NVMe + 32 GB shared_buffers + 2 GB work_mem) was already fast enough at random IO that the planner-cost hint doesn't materially shift query plans.
Bigger payoff is expected on cypher (DO block storage — slower random IO, larger gap between random_page_cost=4 and reality). Cypher empty post-2026-05-04 disk-full incident; can't measure until fwapg reload.
Acceptance (revised):
- M4: no regression on per-WSG wall (within ±5 % of pre-tuning baseline).
- Cypher (next provincial after fwapg reload): median per-WSG wall reduced ≥ 10 % vs pre-tuning baseline.
- Document the asymmetry in
fresh/docker/tuning.md so future readers don't expect identical wins on different hardware.
Cross-ref
Companion rtj issue for the M1/cypher override file — the override's command: list REPLACES the base under docker-compose's merge semantics, so settings added here don't propagate to the 32 GB hosts. Same change must land in both.
Problem
fresh/docker/docker-compose.ymldoesn't setrandom_page_costoreffective_io_concurrency, so postgres falls through to PostgreSQL defaults of4.0and1— both calibrated for spinning rust. All NewGraph hosts run on SSD (M4 NVMe, M1 Colima virtiofs over APFS, cypher DO block storage). Withrandom_page_cost=4, the planner systematically biases away from index scans for segment-keyed lookups in link's pipeline (WHERE blue_line_key = … AND drm <= …againststreams_breaksis the hot path).Verified on M4 + M1 + cypher today (2026-05-04) — all three show
random_page_cost=4,effective_io_concurrency=1,temp_buffers=8MB.Proposed
Add to the
db.commandblock in basedocker-compose.yml:Document in
fresh/docker/tuning.mdalongside the existing memory rationale: SSD cost values, why they matter for link's segment-heavy SQL.Verification
Settings applied locally on M4 (2026-05-04, post-issue-filing) and the change is correctness-driven (planner cost matches actual hardware), not solely performance-driven. ADMS warm-cache wall: 126 s post-tuning vs 129.5 s pre-tuning (M4 morning provincial run) — within ~3 % noise. M4 (Apple Silicon NVMe + 32 GB shared_buffers + 2 GB work_mem) was already fast enough at random IO that the planner-cost hint doesn't materially shift query plans.
Bigger payoff is expected on cypher (DO block storage — slower random IO, larger gap between
random_page_cost=4and reality). Cypher empty post-2026-05-04 disk-full incident; can't measure until fwapg reload.Acceptance (revised):
fresh/docker/tuning.mdso future readers don't expect identical wins on different hardware.Cross-ref
Companion rtj issue for the M1/cypher override file — the override's
command:list REPLACES the base under docker-compose's merge semantics, so settings added here don't propagate to the 32 GB hosts. Same change must land in both.