Close inactive pgsql sessions automatically


  • Used Zammad version: 4.1
  • Operating system: Ubuntu 20.04
  • CPU cores: 2 cores
  • RAM: 16 GB



I have a question about connection to the postgressql-server. We monitor our servers with CheckMK and every two/three days the following error accours:

The problem is this part: Used idle percentage: 97.0% (warn/crit at 80.0%/90.0%)

How can I solve this problem? Is there a way to close idle connection automatcally?
Why I have idle connections? In zammad are 16 users online (only our agents).
After a reboot of the server it works for two/three days.


Not an db expert but our setup is looking like this right now and it performs just fine.:

postgres=> SELECT state,count(state) FROM pg_stat_activity GROUP BY state;
 state  | count
        |     0
 active |     1
 idle   |   155
(3 rows)

Seems to be mostly the worker process + some for the scheduler and rails itself:

postgres=> SELECT application_name,count(application_name) FROM pg_stat_activity WHERE state='idle' GROUP BY application_name;
            application_name            | count
 script/scheduler.rb                    |    10
 puma: cluster worker 2: 12191 [zammad] |    30
 puma: cluster worker 3: 12191 [zammad] |    30
 puma: cluster worker 0: 12191 [zammad] |    30
 puma: cluster worker 1: 12191 [zammad] |    30
 /opt/zammad/bin/rails                  |    25
(6 rows)

Are you having any issues with your setup? If not, it’s probably safe to just disable the check for the zammad host.

Totally IMHO since i’m just a db user - not a dev.
Hopefully someone corrects me if i’m advising total bs here :smiley: .


1 Like


my problem is, if the error accours, that zammad is a little bit slowly. If I close a ticket, the overview needs more time to remove the ticket out of it.

You could just start following recommendations because Zammad keeps these connections up for reasons - so you may want to check the documentation:

1 Like

I have set the max connection from 100 to 200 and test it now. Thanks in advance!

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.