PrismaP
Prisma2y ago
3 replies
citrinitas

index without preview feature

Howdy, I have a user model that I frequently search on with where {}. I wanted to improve performance and read about indices with postgresql. I found that this is a preview feature on the docs, but my handy AI assistant claims I can just do this:
model User {
  id        Int      @id @default(autoincrement())
  firstName String
  lastName  String
  // ... other fields ...

  @@index([firstName])
  @@index([lastName])
}


Does this work out of the box? Will this create an index for those fields in my postgres db and improve performance?

Appreciate the help, folks!
Was this page helpful?