Skip to content

Avoid multiplying trigger and occurrence rows in the Events list - #440

Merged
asselstine merged 1 commit into
mainfrom
codex/events-independent-counts
Nov 24, 2026
Merged

asselstine merged 1 commit into
mainfrom
codex/events-independent-counts

Conversation

@asselstine

Copy link
Copy Markdown
Collaborator

Change

Aggregate trigger counts and occurrence counts independently within the active workspace before joining the current event definitions. Retain ordering, historical occurrences, disabled triggers, and zeros. No UI, endpoint, schema, or visibility changes.

Verification

  • Real PostgreSQL integration test through GET /api/v1/events covers multiple child rows, zero and one-sided counts, historical revisions, order, and the same Event UUID in two workspaces.
  • Local EXPLAIN (ANALYZE, BUFFERS) on a skewed synthetic fixture (4 workspaces; 40 definitions, 108 triggers and 41,700 occurrences per workspace) returned identical data. The prior plan joined 923,400 rows before grouping and spilled to temp storage. The new plan aggregated the two independent child inputs and did not spill. Median across five alternating runs after warm-up: 4,660 ms before, 23 ms after. Not a production measurement.
  • Full npm test attempted. Local Chromium reported target crashes, and Wrangler's local runtime is limited by the sandbox (uv_interface_addresses). CI should independently verify these lanes.

@asselstine
asselstine merged commit 65d8a87 into main Nov 24, 2026
8 checks passed
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