Debug School

rakesh kumar
rakesh kumar

Posted on

how to increase max connection in PostgreSQL

Error

check the current value

sudo vi /etc/postgresql/16/main/postgresql.conf
Enter fullscreen mode Exit fullscreen mode

Increase it (pick ONE method)
Find the line:

max_connections = 100           # (change requires restart)
change to:

max_connections = 300
Enter fullscreen mode Exit fullscreen mode

Step 4 — restart PostgreSQL (required)
max_connections is a static parameter — a reload is NOT enough, you must restart:

sudo systemctl restart postgresql
Enter fullscreen mode Exit fullscreen mode

(Confirm it came back up:)

sudo systemctl status postgresql
Enter fullscreen mode Exit fullscreen mode

Step 5 — verify

sudo -u postgres psql -c "SHOW max_connections;"     # → 300
Enter fullscreen mode Exit fullscreen mode

Top comments (0)