Database & SQL

PostgreSQL Connection Pool Calculator

Enter PostgreSQL max_connections, application server count, and peak RPS to compute optimal PgBouncer pool size and saturation risk.

Calculations run locally in your browser

Example โ€” 100 max connections ยท 4 app servers ยท 4 DB cores ยท 20ms ยท 500 RPS

Recommended total pool
9 conns
(cores ร— 2 + 1) capped by max_connections โˆ’ 5
Per-app pool size
2 conns
total / 4 app servers
Peak concurrent demand
10.0 conns
500 RPS ร— 0.020s avg query
Saturation
111% โ€” โœ— UNDER-PROVISIONED โ€” increase pool or reduce query time
Memory ~750 MB at max_connections
Managed PostgreSQL deployment option. Railway provides hosted PostgreSQL alongside application deployment.
View Railway PostgreSQL options โ†’
External site ยท Independent provider ยท We may receive a commission ยท Not a recommendation

PostgreSQL Connection Pool Calculator

The PostgreSQL Connection Pool Calculator computes optimal PgBouncer pool size and saturation thresholds from max_connections, application server count, and query throughput.

โ€ข Calculate PgBouncer pool_size before configuring a new application tier

โ€ข Determine if current max_connections is sufficient for planned app server scaling

โ€ข Identify connection pool saturation risk at peak load

โ€ข Model connection overhead in shared_buffers for capacity planning

What does this tool tell you?
The PostgreSQL Connection Pool Calculator computes optimal PgBouncer pool size and saturation thresholds from max_connections, application server count, and query throughput.
What affects the result most?
PostgreSQL connection limit: max_connections default 100, each connection uses ~5-10MB shared memory. PgBouncer pool_size: (db_connections - superuser_reserved) / number_of_application_servers. Transaction mode pooling: most efficient โ€” connection returned to pool after each transaction.
How should I use the result?
The calculation is deterministic โ€” the same inputs always produce the same output โ€” so the most useful workflow is to vary one input at a time and see which factor moves the result most. That tells you where to focus your attention before committing to a decision.
Managed PostgreSQL hosting. Railway provides a hosted PostgreSQL option for teams that want a managed database alongside application deployment.
View Railway PostgreSQL options โ†’
External site ยท Independent provider ยท We may receive a commission ยท Not a recommendation