Skip to content

Commit 9a78aa3

Browse files
committed
Add indices for explore and popular
可能会快一点(?
1 parent 1c376cf commit 9a78aa3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- CreateIndex
2+
CREATE INDEX "Post_time_idx" ON "Post"("time");
3+
4+
-- CreateIndex
5+
CREATE INDEX "Post_replyCount_idx" ON "Post"("replyCount" DESC);
6+
7+
-- CreateIndex
8+
CREATE INDEX "Reply_time_idx" ON "Reply"("time");

prisma/schema.prisma

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ model Post {
5252
replies Reply[]
5353
5454
takedown PostTakedown?
55+
56+
@@index([time])
57+
@@index([replyCount(sort: Desc)])
5558
}
5659

5760
model Reply {
@@ -66,6 +69,7 @@ model Reply {
6669
takedown ReplyTakedown?
6770
6871
@@index([postId])
72+
@@index([time])
6973
}
7074

7175
model Activity {

0 commit comments

Comments
 (0)