Skip to content

Commit e900bed

Browse files
committed
Add status-first TaskRun index to speed up uncommon status filters
1 parent e12c82b commit e900bed

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
CREATE INDEX CONCURRENTLY IF NOT EXISTS "TaskRun_status_runtimeEnvironmentId_createdAt_id_idx" ON "TaskRun"("status", "runtimeEnvironmentId", "createdAt", "id" DESC);

internal-packages/database/prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,7 @@ model TaskRun {
686686
@@index([runtimeEnvironmentId, id(sort: Desc)])
687687
@@index([runtimeEnvironmentId, createdAt(sort: Desc)])
688688
@@index([createdAt], type: Brin)
689+
@@index([status, runtimeEnvironmentId, createdAt, id(sort: Desc)])
689690
}
690691

691692
enum TaskRunStatus {

0 commit comments

Comments
 (0)