PostgreSQL Connection Limit Error
Problem Description
Gitlab component logs (for example sidekiq, webservice, praefect) show database errors such as: pq: sorry, too many clients already
Root Cause
Gitlab opened more concurrent PostgreSQL connections than the database allows (exceeded PostgreSQL max_connections).
Troubleshooting
Check the logs of the Gitlab Deployments. Confirm if the pq: sorry, too many clients already error message is present.
Solution
If PostgreSQL's max_connections is too low for your Gitlab scale, increase it on your PostgreSQL side. The exact steps depend on how you manage PG and are out of scope here.
You can use the following command to check PostgreSQL capacity and current usage: