Skip to content

perf(server): batch hydrateRows; per-table catch-up reads use the (tbl,seq) index#14

Merged
grrowl merged 1 commit into
mainfrom
fix/004-catchup-sql-batching
Jun 13, 2026
Merged

perf(server): batch hydrateRows; per-table catch-up reads use the (tbl,seq) index#14
grrowl merged 1 commit into
mainfrom
fix/004-catchup-sql-batching

Conversation

@grrowl

@grrowl grrowl commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Lands plan-004 on main (0.3.2 patch).

  • hydrateRows: was N+1 (one query per key); now chunked IN (≤64 keys/query) — a 500-key reconnect catch-up issues ⌈500/64⌉=8 queries instead of 500. Identifiers quoted, values bound.
  • readChangesSinceFor: per-table changelog read using the _sync_changes_tbl_seq composite index, replacing read-all-then-filter-by-tbl-in-JS in the catch-up emit path.

Behavior is unchanged — same rows, fewer queries.

Merge note: resolved against plan-006 (already on main) — kept the new readChangesSinceFor, honored 006's deletion of the dead snapshotAll (the conflict was adjacency, not semantics).

Validated on main + published @tanstack/db 0.6.5: typecheck + full suite (155 passed, incl. cdc.test.ts batched-hydration coverage) + build green. Supersedes feat/ssr PR #8.

🤖 Generated with Claude Code

…l,seq) index

Catch-up hydration was N+1 (one query per key); now chunked IN (≤64) so a
500-key reconnect issues ⌈500/64⌉=8 queries, not 500. The per-table
changelog read uses the _sync_changes_tbl_seq composite index via the new
readChangesSinceFor() rather than reading all changes and filtering by tbl
in JS.

Merge note: resolved against plan-006 (already on main) — kept the new
readChangesSinceFor and honored 006's deletion of the dead snapshotAll.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@grrowl grrowl merged commit 93acd52 into main Jun 13, 2026
grrowl added a commit that referenced this pull request Jun 13, 2026
Bug-fix batch from the deep-audit follow-up (audit-excluded SSR topic aside):
client reconnect-wedge fix (#12), wire-input hardening + error sanitization
(#15, ADR-0012), catch-up N+1 batching (#14), plus expanded error/wire test
coverage (#11) and dead-code/identifier-quoting cleanup (#13).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant