perf(migration): 0045 streams json_each (no materialize / no temp blowup) #94

Merged
bvandeusen merged 1 commits from dev into main 2026-06-10 22:07:16 -04:00
Owner

Replaces the MATERIALIZED-CTE scalar guard in 0045's backfill with an inline CASE that feeds json_each an empty object for non-object rows. Same scalar guard (no "cannot deconstruct a scalar"), but a single streaming pass — no 100 GB materialization to temp. Prod is at 0044 (the earlier 0045 rolled back), so this is the 0045 that runs on next deploy.

(Today's local-disk fill was unrelated — accumulated container images in /var/lib/containerd, since pruned. Migration temp goes to NFS, which has room.)

CI green on dev e6d5f67 (run 856).

🤖 Generated with Claude Code

Replaces the MATERIALIZED-CTE scalar guard in 0045's backfill with an inline `CASE` that feeds `json_each` an empty object for non-object rows. Same scalar guard (no "cannot deconstruct a scalar"), but a single streaming pass — no 100 GB materialization to temp. Prod is at 0044 (the earlier 0045 rolled back), so this is the 0045 that runs on next deploy. (Today's local-disk fill was unrelated — accumulated container images in /var/lib/containerd, since pruned. Migration temp goes to NFS, which has room.) CI green on dev `e6d5f67` (run 856). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
bvandeusen added 1 commit 2026-06-10 22:07:10 -04:00
perf(migration): 0045 streams json_each via inline CASE guard (no temp spill)
CI / lint (push) Successful in 2s
CI / frontend-build (push) Successful in 23s
CI / backend-lint-and-test (push) Successful in 33s
CI / integration (push) Successful in 3m20s
e6d5f67f11
The MATERIALIZED-CTE scalar guard forced Postgres to materialize all object
rows with their full JSON (~100 GB) to temp before json_each — on NFS that's a
huge spill and pathologically slow (risks disk-full). Replace with an inline
CASE that feeds json_each an empty object for non-object rows: same scalar
guard, but a single streaming pass with no materialization.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bvandeusen merged commit 444c1fb075 into main 2026-06-10 22:07:16 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bvandeusen/FabledCurator#94