Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Improve search responsiveness for group-constrained queries
CREATE INDEX IF NOT EXISTS "challenge_groups_gin_idx"
ON "challenges"."Challenge"
USING GIN ("groups");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
Ensure that the groups column is of a type that supports GIN indexing, such as jsonb or array. Using GIN on unsupported types can lead to unexpected behavior or performance issues.

1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ model Challenge {
@@index([updatedAt])
@@index([typeId])
@@index([trackId])
@@index([groups], type: Gin, map: "challenge_groups_gin_idx")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ performance]
The use of a GIN index on the groups array field is appropriate for improving query performance involving array operations. However, ensure that the pg_trgm extension is enabled in your PostgreSQL database if you plan to use trigram-based searches with this index. Without it, certain operations may not perform as expected.

@@index([submissionStartDate])
@@index([submissionEndDate])
@@index([registrationStartDate])
Expand Down
Loading