Reputation: 11
Title says it all.
Is it better to open a connection to my db when the app is initialized or should I connect and release the client for each query?
How do I use a connection pool correctly?
Upvotes: 0
Views: 503
Reputation: 247235
Opening and closing database connections repeatedly is a waste of time and CPU power. Therefpre, you should always use a connection pool.
When you use a connection pool, you don't open and xlose the connection, but take it from the pool and return it when you are done.
Upvotes: 1