Articles in this section
Category / Section

How to Resolve the "Too Many Client Already" Error in Postgre SQL Data Source

Published:

You may encounter the error “too many clients already” when connecting to a PostgreSQL data source. This error occurs when there are too many open connections to the PostgreSQL server. This article will guide you through the steps to resolve this issue.

image.png

Cause

An excessive number of open connections to the PostgreSQL server causes the error.

Solution

To resolve this issue, follow these steps:

  1. To get the list of active connections, run the following query:

    SELECT * FROM pg_stat_activity;
    

    image.png

  2. Run the following query to close the active connections.

    SELECT pg_terminate_backend(pid)
    FROM pg_stat_activity
    WHERE pid <> pg_backend_pid()
    AND datname IS NOT NULL
    AND leader_pid IS NULL;
    

    image.png

You should be able to resolve this issue by closing the active connections.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
IJ
Written by Israel Jebaraj Chandirakumar
Updated
Comments
Please  to leave a comment
Access denied
Access denied