Skip to content

Commit

Permalink
perf: optimize indices (#2367)
Browse files Browse the repository at this point in the history
  • Loading branch information
hassiebp committed Jun 18, 2024
1 parent f147d2b commit 2a30f54
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- DropIndex
DROP INDEX CONCURRENTLY IF EXISTS "observations_parent_observation_id_idx";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- DropIndex
DROP INDEX CONCURRENTLY IF EXISTS "observations_updated_at_idx";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- DropIndex
DROP INDEX CONCURRENTLY IF EXISTS "scores_updated_at_idx";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- DropIndex
DROP INDEX CONCURRENTLY IF EXISTS "traces_external_id_idx";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- DropIndex
DROP INDEX CONCURRENTLY IF EXISTS "traces_release_idx";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- DropIndex
DROP INDEX CONCURRENTLY IF EXISTS "traces_updated_at_idx";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- CreateIndex
CREATE INDEX CONCURRENTLY "traces_project_id_timestamp_idx" ON "traces"("project_id", "timestamp");
7 changes: 1 addition & 6 deletions packages/shared/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,12 @@ model Trace {
JobExecution JobExecution[]
@@index([projectId])
@@index([projectId, timestamp])
@@index([sessionId])
@@index([name])
@@index([userId])
@@index([id, userId])
@@index([externalId])
@@index(timestamp)
@@index(release)
@@index(updatedAt)
@@index(createdAt)
@@index([tags(ops: ArrayOps)], type: Gin)
@@map("traces")
Expand Down Expand Up @@ -328,9 +326,7 @@ model Observation {
@@index([type])
@@index(startTime)
@@index(createdAt)
@@index(updatedAt)
@@index(projectId)
@@index(parentObservationId)
@@index(model)
@@index(internalModel)
@@index([projectId, promptId])
Expand Down Expand Up @@ -429,7 +425,6 @@ model Score {
@@index([observationId], type: Hash)
@@index([source])
@@index([createdAt])
@@index([updatedAt])
@@map("scores")
}

Expand Down

0 comments on commit 2a30f54

Please sign in to comment.