How Can I Resolve the Issue with PostgreSQL when the Error is Shown in the Logs: "53300: sorry, too many clients already"?

Issue:

This issue occurs with the error "53300: sorry, too many clients already" in the logs when using the PostgreSQL database when the maximum number of concurrent connections is reached (100 by default) in the database settings.


To resolve this issue, change the value in the DB settings, by doing the following:

1) Stop the EkranServer service.

2) On the machine where the PostgreSQL database is installed, open the main folder which by default is:

C:\ProgramFiles\PostgreSQL\13\data

3) In this folder, open the postgresql.conf file, and modify the max_connections value (replace the default value of "100" by "1000").

4) Save and close the file.

5) Restart the PostgresSQL service in Windows Services.

6) Restart the EkranServer service.


To check the actual size of the database or any of its tables, the following commands can be used:

To view the size of the database in a readable format: SELECT pg_size_pretty( pg_database_size('ekranactivitydb') ) 

To view the size of a database table in a readable format: SELECT pg_size_pretty( pg_total_relation_size('dbo."SESSIONS"') )