postgres icon indicating copy to clipboard operation
postgres copied to clipboard

Configure a minimum connection pool size

Open reecefenwick opened this issue 2 years ago • 3 comments

Is it possible to configure the postgres client to maintain a minimum connection pool size?

Creating connections is an expensive process, I'm looking to ensure a minimum baseline of connections to mitigate latency as the pool warms up to it's max

reecefenwick avatar Sep 08 '23 01:09 reecefenwick

I see, so you'd like to have let's say max: 20, but let them close with idle_timeout, except for a specific min number that should stay open ready to take queries. That's a neat idea! Would it be fine simply to have a min option which would set the amount of connections not being targeted by idle_timeout, and also being opened on first query by default?

porsager avatar Oct 26 '23 21:10 porsager

Yes exactly @porsager 🙂

This is something I've experienced in a few database drivers, mostly in the Java ecosystem. Not 100% sure how they are typically implemented but the behaviour you describe sounds quite good

reecefenwick avatar Dec 28 '23 01:12 reecefenwick