Files
goodgo-platform/prisma/migrations/20260408160000_add_review_userid_index/migration.sql
Ho Ngoc Hai 0abf9df84e fix(db): add missing Review.userId index for FK query performance
The Review table was missing an index on userId, causing full table scans
when querying reviews by user. All other FK columns across 22 models were
verified to have proper indexes already (including Listing.sellerId which
was added in a prior migration).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-08 22:43:59 +07:00

6 lines
305 B
SQL

-- CreateIndex
-- Safe for production: CREATE INDEX CONCURRENTLY does not lock the table for writes.
-- Note: Prisma migrations do not support CONCURRENTLY natively.
-- For large tables, run this manually with CONCURRENTLY outside of a transaction.
CREATE INDEX "Review_userId_idx" ON "Review"("userId");