Skip to content

Commit 0e14b6d

Browse files
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 correctly
1 parent bf736a7 commit 0e14b6d

File tree

10 files changed

+27
-514
lines changed

10 files changed

+27
-514
lines changed

apps/webapp/app/routes/admin.feature-flags.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
5555

5656
// Resolve env-based defaults for locked flags
5757
const resolvedDefaults: Record<string, string> = {
58-
[FEATURE_FLAG.runsListRepository]: "clickhouse",
5958
[FEATURE_FLAG.taskEventRepository]: env.EVENT_REPOSITORY_DEFAULT_STORE,
6059
};
6160

apps/webapp/app/services/runsRepository/postgresRunsRepository.server.ts

Lines changed: 0 additions & 344 deletions
This file was deleted.

0 commit comments

Comments
 (0)