Hey! Just getting started with Prisma, and I have...
# orm-help
s
Hey! Just getting started with Prisma, and I have a question regarding connecting and disconnecting. I've read this >> https://www.prisma.io/docs/concepts/components/prisma-client/working-with-prismaclient/connection-management, but still a little unsure on something. If I do something like this
Copy code
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
const allPosts: Post[] = await prisma.post.findMany()
Each time this is called, what happens to the prisma client? Does it auto disconnect when done, and next time it's called a new one is created (then closed) or will I end up with 1000's of these open and running in the background? If so, do I need to just create one and use that all the time? How does that work if it has to handle 1000's of requests at once? I guess I'm just after a little guidance on how best to approach. I get these are likely basic questions! I'm moving over from Python / Django and trying to get my head around things. Thanks!
1
Is it just me, or does anyone else tend to find they usually answer their own questions around 30 mins after asking 🙄
r
Hi @StevieW 👋 I'm glad you could resolve the issue by checking on the relevant page on our documentation. If you have any more queries, don't hesitate to ask and we'll do well to answer within a short time span.
👍 2