Database connection pool size calculator

Enter the database server's CPU cores and disks, how many application instances share it, and your query rate and average query time. The calculator gives the classic starting pool size, the pool for each instance and how many connections your load keeps busy on average.

/s
ms
Pool size, all instances17
Pool size per instance9
Connections busy on average
6
Pool utilisation
35.3 %

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Enter the CPU cores of the database server (physical cores, not hyper-threads) and the number of disks that serve the data.
  2. Enter how many application instances (pods, processes) share the database.
  3. Enter the total query rate and the average time a query keeps its connection, including network round trips and time inside a transaction.

Formulas

  • Pool total = cores × 2 + effective spindles
  • Per instance = ceil(pool total ÷ instances)
  • Busy connections (Little’s law) = queries per second × query time in seconds
  • Utilisation = busy ÷ pool total

Worked example

A database with 8 cores and 1 disk, used by 2 instances at 400 queries per second, 15 ms each:

  • Pool total: 8 × 2 + 1 = 17.
  • Per instance: ceil(17 ÷ 2) = 9.
  • Busy: 400 × 0.015 = 6 connections; utilisation 6 ÷ 17 = 35.3 %.

Tips

  • Above 100 % utilisation queries queue. Make queries faster or reduce how long transactions keep their connection before you add connections.
  • Count every client. Background workers, cron jobs and admin tools draw from the same database limit (max_connections in PostgreSQL).
  • Keep the pool fixed. Setting the minimum idle connections equal to the maximum avoids latency spikes when the pool has to open new connections under load.

Frequently asked questions

What is the formula for connection pool size?

A widely quoted starting point, from the PostgreSQL wiki and the HikariCP documentation, is connections = (core count × 2) + effective spindle count, where the cores are those of the database server. For 8 cores and one disk: 8 × 2 + 1 = 17 connections.

Is the formula per application or for the whole database?

For the whole database. If several application instances connect, they share that number: 17 connections over 2 instances is 9 each after rounding up. Giving each instance its own 17 would double the load on the database.

What counts as a spindle on an SSD?

Spindles stand for disks that can seek in parallel. With SSDs or data that fits in memory, I/O waits are short and the term counts for little; many people use 0 or 1. Treat the result as a starting point and measure.

Why is a smaller pool often faster?

A CPU core runs one query at a time. With far more active connections than cores, the database spends time switching between them and contending for locks and disk. A small pool with a short queue in the application usually gives better latency than hundreds of connections.

More in Developer

All tools in this category: Developer ·Updated November 7, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.