is it bad to have many Prisma instances ?
I was using prisma and i was making a new prisma instance for each file and then i got an warning saying
you are having more than 10 active prisma instances at once
so i removed them and just exported one from a file
but im wondering what's the issue with many prisma instances ?1 Reply
Usually if you are making use of a database in an application you’d get pooling involved.
When a query needs a connection to do something it’s gonna go to the pool handler and get a connection. If there are multiple instances involved it can lead to contention of connections because your db only has 100 available and each pool will hold 25.
Pretty general statement but should still be applicable to prisma
The limits on number of connections in a database is related to how many resources it has access to so that 100 number can vary. You can also adjust the numbers a pool will take in most apis.
In regards to prisma they generally recommend only instantiating it once so I’d stick to that.