Search code examples
databasenext.jsprisma

Should i disconnect my prisma client after every query in NextJs?


Some months ago, I tried to do somethings with NextJs and mongoose, but I got a lot of problems about too many connections in my mongo database. I think the main problem was the NextJs way to do the things. Now Im learning about NextJs + Prisma with Postgresql, do i need end my connections when I end queries?

When i tried use mongoose, I create some cache for the database to not create a connection everytime, but the same thing kept happening: Too many connections. Its the same for prisma?


Solution

  • With prisma it's possible to instantiate and not create many connections like shown here

    hope this solves your problem