{"head":{"title":"What Is Database Connection Pooling? Definition | OceanLab","description":"Connection pooling reuses a fixed set of database connections across requests instead of opening a new one each time. Why it matters and common mistakes.","canonical":"https://oceanlab.in/glossary/connection-pooling"},"crumbs":[{"name":"Home","path":"/"},{"name":"Glossary","path":"/glossary"},{"name":"connection pooling","path":"/glossary/connection-pooling"}],"slug":"connection-pooling","term":"Connection pooling","aka":["connection pool","database pooler"],"category":"System design","short":"Keeping a set of open database connections and sharing them across requests, instead of opening a new connection for each one.","body":[["Opening a database connection takes time and memory on the database server, and databases allow only so many at once. A pool keeps some connections open and lends one to each request, then takes it back. The pool can live inside the app or in a separate pooler service in front of the database."],["Poolers often work in different modes, such as one connection per transaction or per session. The mode decides which database features, like session settings or prepared statements, still work."]],"why":["Without pooling, a traffic spike or a burst of ",{"href":"/glossary/serverless","text":"serverless"}," instances can open more connections than the database allows, and the whole app goes down. Pooling keeps the database steady and cuts the time each request spends waiting."],"example":["A SaaS app on serverless functions starts failing at peak with too many connections errors. Each function instance opened its own connection. Routing them through a pooler with a fixed limit fixes the errors without a bigger database."],"inBuild":["We size the pool to what the database can handle, not what the app might want, use a pooler for serverless and ",{"href":"/glossary/autoscaling","text":"autoscaling"}," apps, and set timeouts so a stuck query cannot hold a connection forever. Pool usage is a dashboard metric from the start."],"mistakes":[["Each app instance opening a large pool, so the total exceeds the database limit."],["Using session features in transaction mode and getting odd bugs."],["Long-running transactions that keep connections out of the pool."]],"related":[{"href":"/glossary/read-replica","label":"Read replica","detail":"A read-only copy of a database that is kept in sync with the main database and takes read queries off it."},{"href":"/glossary/serverless","label":"Serverless","detail":"A cloud model where the provider runs your code on demand and manages the servers, and you pay for what you use rather than for idle machines."},{"href":"/glossary/cold-start","label":"Cold start","detail":"The extra delay when a serverless function or a new server instance has to start up before it can handle a request."},{"href":"/glossary/autoscaling","label":"Autoscaling","detail":"Automatically adding or removing computing capacity, such as servers or containers, as the load on a system goes up or down."},{"href":"/glossary/sharding","label":"Sharding","detail":"Splitting one large dataset across several databases, called shards, by a key such as customer ID, so each shard holds only part of the data."}],"tools":[],"links":[{"href":"/pricing/categories/databases","label":"Database pricing","detail":"Managed database prices, with sources."}],"sources":[],"legal":false,"updatedAt":"2026-10-25"}