Re: Max connections reached without max connections reached - Mailing list pgsql-general

From James Sewell
Subject Re: Max connections reached without max connections reached
Date
Msg-id CAANVwEsT8WLVTdpifGbFBW5JVfX1873LJADjuLnUVDrrqmhvEQ@mail.gmail.com
Whole thread Raw
In response to Re: Max connections reached without max connections reached  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
> Sorry, I could have been clearer - pg_stat_activity is what I'm looking
> at - I'm recording connection info from here every 15 seconds (from a
> superuser account so I don't get locked out). It never peaks above 300
> (in fact when the incident happens no new connections can come in so it
> falls to around 100) - yet I'm seeing the log lines claim that I'm still
> hitting 597 (600 - 3 reserved).

What is the query you are using against pg_stat_activity?


For general counts ad-hoc we just use:

SELECT count(*) FROM pg_stat_activity

The monitoring system runs:

SELECT CASE WHEN usename IS NOT NULL THEN usename ELSE 'SYSTEM' END as role, 
        datname AS database,
        state,
        wait_event,
        count(*) AS connection
FROM pg_stat_activity
GROUP BY 1,2,3,4

 


The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Max connections reached without max connections reached
Next
From: James Sewell
Date:
Subject: Re: Max connections reached without max connections reached