Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(cdp): index batch resolver jobs by parent run (#118530)

Harley Alexander11357ce09722
diff --git a/rust/cyclotron-node-migrations/20261016000001_add_batch_resolver_parent_index.sql b/rust/cyclotron-node-migrations/20261016000001_add_batch_resolver_parent_index.sql
new file mode 100644
index 000000000000..cdf762ea8144
--- /dev/null
+++ b/rust/cyclotron-node-migrations/20261016000001_add_batch_resolver_parent_index.sql
@@ -0,0 +1,7 @@
+-- no-transaction
+-- A realtime cohort's ready callback looks up the batch resolver of one batch run. A workflow can hold a
+-- large backlog of invocation jobs, so a partial index keeps that lookup to the resolver rows instead of
+-- scanning the workflow's jobs through the function_id index.
+CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_cyclotron_jobs_batch_resolver_parent_run
+ ON cyclotron_jobs (team_id, parent_run_id)
+ WHERE queue_name = 'hogflow_batch_resolve';