fix(server): index hot Postgres query paths (#2218)

This commit is contained in:
RainbowBird
2026-08-04 21:24:26 +08:00
committed by GitHub
parent e6ca9750b4
commit 2abb1ac9ff
6 changed files with 3679 additions and 5 deletions
+4 -1
View File
@@ -80,7 +80,10 @@ export const account = pgTable(
.$onUpdate(() => /* @__PURE__ */ new Date())
.notNull(),
},
table => [index('account_userId_idx').on(table.userId)],
table => [
index('account_userId_idx').on(table.userId),
index('account_account_id_provider_id_idx').on(table.accountId, table.providerId),
],
)
export const verification = pgTable(
+1
View File
@@ -95,6 +95,7 @@ export const messages = pgTable(
deletedAt: timestamp('deleted_at'),
},
table => [
index('messages_chat_id_seq_idx').on(table.chatId, table.seq),
index('messages_chat_id_seq_active_idx')
.on(table.chatId, table.seq)
.where(sql`${table.deletedAt} IS NULL`),