Skip to content

latency(P5): add BatchGetItem primitive; collapse N+1 get_by_id enrichment loops #38

Closed

Description

@jjbaumert

Priority: P5 (latency, not cost) — Tier 2. Part of the 2026-07-11 DynamoDB query-cost review.

Problem

The storage layer has no BatchGetItem primitive. The dominant enrichment pattern is list_* (Query) followed by a sequential get_by_id per item — ~91 sites across 14 route files; routes/scim.rs:142 self-flags it ("a future piece could swap in a BatchGet"). Also comments.rs, chat.rs member hydration.

Fix

Add a batch_get primitive to storage and convert the N+1 enrichment loops.

Honest scope note

These are cross-partition single-item gets, so BatchGetItem costs ~the same RCU as N GetItems — this is a latency / round-trip win (p99), not a bill reduction. Prioritized below the Tier-1 cost items deliberately.

CRDT impact: none (user/member metadata).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions