From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joshua White <joshua.white@monash.edu>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Ron <ronljohnsonjr@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Does idle sessions will consume more cpu and ram? If yes,how to control them
Date: Wed, 19 Dec 2018 23:45:20 -0500
Message-ID: <22292.1545281120@sss.pgh.pa.us> (raw)
In-Reply-To: <CAGY1NO=oYwQ2rxwHEHte9ctuMTHaCJX_b4kYVKWKL3AwyeXB-g@mail.gmail.com>
References: <CAEHH7R5wnqTJ3gxiBmVfQLk2CXa2k+xpq24Ma2edCaQm2jntbw@mail.gmail.com>
<CAGY1NOnUMH=+RUkEnyF3RyY2Bieruh5A+y-7T_49xoXj47MP3w@mail.gmail.com>
<20181220012718.GI27104@paquier.xyz>
<de4c1915-f8b3-43e9-016f-f80dbe11c274@gmail.com>
<CAFj8pRC0M8oM=P1wdf54iBMRnbA0PUBy4mDDfrvcJyf6iBaamg@mail.gmail.com>
<CAGY1NO=oYwQ2rxwHEHte9ctuMTHaCJX_b4kYVKWKL3AwyeXB-g@mail.gmail.com>
Joshua White <joshua.white@monash.edu> writes:
> On Thu, 20 Dec 2018 at 14:35, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>> čt 20. 12. 2018 v 2:41 odesílatel Ron <ronljohnsonjr@gmail.com> napsal:
>>> So it's best to kill connections that have been idle for a while?
>> sure - one hour idle connection is too old.
> I'd also assess closing the connection from the client end once its task is
> done - that would reduce the number of idle connections in the first place.
IMO, "has it been idle a long time" is the wrong question. The right
question is "how likely is it to start doing something useful soon".
Certainly, leaving sessions sit doing nothing for a long time isn't
helpful. They consume RAM, they have to be accounted for by other
sessions, and if you're doing any DDL, they consume CPU time
maintaining their own caches in response to catalog changes. But it's
also true that starting a new session has a lot of overhead --- so you
don't want to kill a session that was just about to start doing some
useful work.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, joshua.white@monash.edu, pavel.stehule@gmail.com, ronljohnsonjr@gmail.com
Subject: Re: Does idle sessions will consume more cpu and ram? If yes,how to control them
In-Reply-To: <22292.1545281120@sss.pgh.pa.us>
References: <CAEHH7R5wnqTJ3gxiBmVfQLk2CXa2k+xpq24Ma2edCaQm2jntbw@mail.gmail.com> <CAGY1NOnUMH=+RUkEnyF3RyY2Bieruh5A+y-7T_49xoXj47MP3w@mail.gmail.com> <20181220012718.GI27104@paquier.xyz> <de4c1915-f8b3-43e9-016f-f80dbe11c274@gmail.com> <CAFj8pRC0M8oM=P1wdf54iBMRnbA0PUBy4mDDfrvcJyf6iBaamg@mail.gmail.com> <CAGY1NO=oYwQ2rxwHEHte9ctuMTHaCJX_b4kYVKWKL3AwyeXB-g@mail.gmail.com> <22292.1545281120@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox