Issue: an application opens many PostgreSQL connections. The team is considering pooling but has not established whether the constraint is connection setup, concurrent work or a transaction holding resources for too long. This memo prepares a decision; it is not permission to change production settings automatically.
Initial answer: a pool can help when connection management is a real constraint and the application supports the chosen mode. It does not repair slow SQL by itself or give the database unlimited capacity. Another layer can simply relocate a queue, so define the outcome before selecting software.
Evidence to bring to the discussion
Record PostgreSQL and application driver versions, connection counts, active versus idle sessions and peak intervals. Distinguish sessions that are idle inside an open transaction. Seeing 100 connections does not tell you that all are doing useful work simultaneously; some may reflect application lifecycle problems.
Do not include personal information from SQL parameters. Aggregated counts, durations and states are sufficient for the first decision. If deeper inspection is necessary, define access and minimum required data separately. Verify monitoring capabilities for the actual PostgreSQL version rather than assuming every version exposes identical views.
Compare the options
| Option | What needs checking |
|---|---|
| Existing application pool | Connection return, limit and timeout |
| Separate pooler | Mode compatibility and a new operating responsibility |
| Only increasing connections | Resource allocation and actual database throughput |
The PostgreSQL connection settings documentation explains that increasing max_connections increases allocation of certain resources. Raising the limit is therefore not free processing capacity. Establish how much work completes acceptably and when waiting begins to grow.
The pooling implementation is a subsequent choice. PgBouncer's feature documentation distinguishes session and transaction pooling; transaction mode has limitations for session-dependent features. Check support against the actual version and configuration rather than copying parameters from an unrelated example.
Compatibility a quick homepage check will miss
Determine whether the application relies on session state, temporary tables, prepared statements or session-level locks. Their presence does not universally prohibit pooling, but affects the mode and test design. Inspect real use in the code and driver rather than inferring compatibility from a technology name.
A homepage may work while an occasional reporting job fails. In safe staging, include different user contexts and reused connections. Use artificial data and prevent real email or payment side effects. Success should mean a relevant operation completed correctly, not merely that a connection opened.
Acceptance measurements
- Waiting time to obtain a connection and queue length.
- Important request durations and errors.
- Database CPU, memory and concurrent work.
- Clear timeout behaviour and safe retries.
- Correct data isolation and preserved permissions.
Coordinate pool limits across web workers and background processes. Preserve an administrative recovery path, and do not expose the database publicly merely to connect a new component. Network and authentication boundaries are part of the design, not obstacles to remove for an easier test.
Write the recommendation
State the observed problem, selected option, alternative explanation, test result and return path. If fixing the existing connection lifecycle is sufficient, another pooler is unnecessary. If a new component is justified, ownership and monitoring belong in the implementation. Compare outcomes under similar work rather than two unrelated numbers from different days.
Memory planning is covered in our MySQL and PostgreSQL resource guide; placement is discussed in running the database on a separate VPS. Bring a connection and workload summary when choosing an unmanaged VPS.



