Commit 0e14b6d
authored
TaskRun optimizations: dropping FKs and some indexes (#3309)
## Summary
- Drop all 8 foreign key constraints on TaskRun. The run listing path is
now fully ClickHouse-backed so we no longer need Postgres to enforce
referential integrity on this table. The FK constraints add write
overhead on every insert/update with no remaining benefit. Prisma
queries are unaffected.
- Remove PostgresRunsRepository and its associated feature flag
(runsListRepository), which was the last remaining code path querying
TaskRun directly for list/count operations.
- Drop three indexes that were only useful for the Postgres run list
path and have no remaining query consumers:
- TaskRun_runtimeEnvironmentId_id_idx — was the cursor pagination index
for PostgresRunsRepository; superseded by the (runtimeEnvironmentId,
createdAt DESC) composite index
- TaskRun_scheduleId_idx — redundant with the (scheduleId, createdAt
DESC) composite index; no direct Postgres queries filter by scheduleId
alone
- TaskRun_rootTaskRunId_idx — no queries filter TaskRun by rootTaskRunId
as a WHERE clause anywhere in the codebase
All index drops use CONCURRENTLY IF EXISTS to avoid table locks in
production.
## Test plan
- pnpm run db:migrate:deploy applies all migrations cleanly
- pnpm run typecheck --filter webapp passes
- Run list pages load correctly in the dashboard (ClickHouse path)
- Scheduled task runs still trigger and appear correctly1 parent bf736a7 commit 0e14b6d
File tree
10 files changed
+27
-514
lines changed- apps/webapp/app
- routes
- services/runsRepository
- v3
- eventRepository
- internal-packages/database/prisma
- migrations
- 20260401000000_drop_taskrun_foreign_keys
- 20260401130744_drop_task_run_runtime_environment_id_index
- 20260401132332_drop_task_run_schedule_id_idx
- 20260401132508_drop_task_run_root_task_run_id_idx
10 files changed
+27
-514
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
| |||
Lines changed: 0 additions & 344 deletions
This file was deleted.
0 commit comments