Is it normal to have too many idle processes in postgresql cluster?

Started by Abdul Qoyyuumabout 5 years ago3 messagesgeneral
Jump to latest
#1Abdul Qoyyuum
aqoyyuum@cardaccess.com.au

Hi all, I have a database cluster running Postgresql 9.6 on RHEL 6 servers.
I've noticed a lot of idle processes in the master database as opposed to
the slave database and from the looks of pg_activity, they're all idle
statements like "SELECT 1". Forums and StackOverflow seems to suggest its
nothing to worry about but

[user@db1.pr ~]$ ps -ef | grep postgres | grep idle | wc -l
213

Seems to get me worried. Should I be worried? Is this normal? If not, what
should I do?
--
Abdul Qoyyuum Bin Haji Abdul Kadir
HP No: +673 720 8043

#2Christophe Pettus
xof@thebuild.com
In reply to: Abdul Qoyyuum (#1)
Re: Is it normal to have too many idle processes in postgresql cluster?

On Mar 7, 2021, at 17:34, Abdul Qoyyuum <aqoyyuum@cardaccess.com.au> wrote:
Seems to get me worried. Should I be worried? Is this normal? If not, what should I do?

It's normal. Every connected client has an associated backend process, even if the client isn't doing anything. That's what the "idle" state means. You can consider using a pooler such as pgbouncer to reduce the number of connections the clients have open, although 200 open connections is nothing concerning.

--
-- Christophe Pettus
xof@thebuild.com

#3Abdul Qoyyuum
aqoyyuum@cardaccess.com.au
In reply to: Christophe Pettus (#2)
Re: Is it normal to have too many idle processes in postgresql cluster?

Thanks Christophe! I guess I had nothing to be worried about.

On Mon, Mar 8, 2021 at 9:46 AM Christophe Pettus <xof@thebuild.com> wrote:

On Mar 7, 2021, at 17:34, Abdul Qoyyuum <aqoyyuum@cardaccess.com.au>

wrote:

Seems to get me worried. Should I be worried? Is this normal? If not,

what should I do?

It's normal. Every connected client has an associated backend process,
even if the client isn't doing anything. That's what the "idle" state
means. You can consider using a pooler such as pgbouncer to reduce the
number of connections the clients have open, although 200 open connections
is nothing concerning.

--
-- Christophe Pettus
xof@thebuild.com

--
Abdul Qoyyuum Bin Haji Abdul Kadir
HP No: +673 720 8043