Aniruddha Mukherjee

But what's database pooling?

What is Database pooling?

You might be aware that the word pooling means sharing some resource with others, like car pooling. The concept is the same here. In database land, we share a bunch of open connections to the database with clients.

Usually, when a database is hosted on a remote server, you have to open new TCP connection for each query you make. Since opening a new TCP connection is costly (both in terms of time and CPU operations), and involves multiple steps, we try to reuse existing connections as much as possible. This is the core idea behind database pooling.

In database pooling, we maintain a set of open connections (from the web server) to the database to use them for different queries without the need for cold starting new ones for different queues from different clients.

Here is a infographic depicting this concept, courtesy of this blog post.

database pooling