Re: Does idle sessions will consume more cpu and ram? If yes,how tocontrol them - Mailing list pgsql-general

From Michael Paquier
Subject Re: Does idle sessions will consume more cpu and ram? If yes,how tocontrol them
Date
Msg-id 20181220012718.GI27104@paquier.xyz
Whole thread Raw
In response to Re: Does idle sessions will consume more cpu and ram? If yes,how tocontrol them  (Joshua White <joshua.white@monash.edu>)
Responses Re: Does idle sessions will consume more cpu and ram? If yes,how tocontrol them  (Ron <ronljohnsonjr@gmail.com>)
List pgsql-general
On Thu, Dec 20, 2018 at 11:32:22AM +1100, Joshua White wrote:
>> In my application, the idle sessions are consuming cpu and ram. refer the
>> ps command output.
>>
>
> If you connect to the database, does select * from pg_stat_activity() show
> a lot of idle connections?

Each backend stores its own copy of the relation cache, so if you have
idle connections which have been used for other work in the past then
the memory of those caches is still around.  Idle connections also have
a CPU cost in Postgres when building snapshots for example, and their
entries need to be scanned from a wider array, but usually the relation
cache bloat is a wider problem.  This can be countered with pgbouncer as
connection pooling.
--
Michael

Attachment

pgsql-general by date:

Previous
From: Joshua White
Date:
Subject: Re: Does idle sessions will consume more cpu and ram? If yes,how tocontrol them
Next
From: Ron
Date:
Subject: Re: Does idle sessions will consume more cpu and ram? If yes,how tocontrol them