Skip to content

Commit

Permalink
Add indices for explore and popular
Browse files Browse the repository at this point in the history
可能会快一点(?
  • Loading branch information
wxh06 committed Nov 4, 2023
1 parent 1c376cf commit 9a78aa3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions prisma/migrations/20231104152326_indices/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- CreateIndex
CREATE INDEX "Post_time_idx" ON "Post"("time");

-- CreateIndex
CREATE INDEX "Post_replyCount_idx" ON "Post"("replyCount" DESC);

-- CreateIndex
CREATE INDEX "Reply_time_idx" ON "Reply"("time");
4 changes: 4 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ model Post {
replies Reply[]
takedown PostTakedown?
@@index([time])
@@index([replyCount(sort: Desc)])
}

model Reply {
Expand All @@ -66,6 +69,7 @@ model Reply {
takedown ReplyTakedown?
@@index([postId])
@@index([time])
}

model Activity {
Expand Down

0 comments on commit 9a78aa3

Please sign in to comment.