-
Notifications
You must be signed in to change notification settings - Fork 6
Additional indices for performance issues noted #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| -- Add indexes to support faster `/v6/my-reviews` queries. | ||
|
|
||
| CREATE EXTENSION IF NOT EXISTS pg_trgm; | ||
|
|
||
| CREATE INDEX IF NOT EXISTS "challenge_status_type_track_created_at_idx" | ||
| ON "Challenge" ("status", "typeId", "trackId", "createdAt" DESC); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| CREATE INDEX IF NOT EXISTS "challenge_phase_challenge_open_end_idx" | ||
| ON "ChallengePhase" ("challengeId", "isOpen", "scheduledEndDate", "actualEndDate"); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS "challenge_name_trgm_idx" | ||
| ON "Challenge" | ||
| USING gin ("name" gin_trgm_ops); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -155,6 +155,8 @@ model Challenge { | |
| @@index([endDate]) | ||
| @@index([status, startDate]) | ||
| @@index([trackId, typeId, status]) | ||
| @@index([status, typeId, trackId, createdAt(sort: Desc)], map: "challenge_status_type_track_created_at_idx") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| @@index([name], type: Gin, ops: [gin_trgm_ops], map: "challenge_name_trgm_idx") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| @@index([legacyId]) | ||
| @@index([projectId, status]) | ||
| } | ||
|
|
@@ -540,6 +542,7 @@ model ChallengePhase { | |
| @@index([challengeId]) | ||
| @@index([challengeId, isOpen]) | ||
| @@index([challengeId, name]) | ||
| @@index([challengeId, isOpen, scheduledEndDate, actualEndDate], map: "challenge_phase_challenge_open_end_idx") | ||
| } | ||
|
|
||
| ////////////////////////////////////////// | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗
correctness]Ensure that the
pg_trgmextension is supported and available in all environments where this migration will be applied. If not, this could lead to errors during deployment.