-3

Please explain me what is connection pool in Postgres and MongoDB database.

  • 1
    What research have you done so far? A simple Bing brings up a wealth of information. – Anthony Genovese Feb 26 at 15:48
0

A connection pool is a software component that acts as a kind of proxy or multiplexer between the application code and the database.

Instead of opening a database connection in your code, you request a connection from the pool, and you return the connection to the pool rather than closing it. The connection pool maintains a number of persistent database connections that get reused.

Connection pools are usually built into the application server or database driver code, but they can be standalone programs like pgBouncer.

The advantages of connection pools are twofold:

  1. It avoids waste of database processing power by opening and closing database connections all the time, which can be a quite expensive operation.

  2. It provides an artificial bottleneck to keep the database from being overloaded by too many concurrent requests.

    Often, connection pools will keep processes/threads suspended in a queue if no database connection is available at the moment rather than making the requests fail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.