From: Tom Lane <tgl@sss.pgh.pa.us>
To: Øystein Kolsrud <kolsrud@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: PostgreSQL processes use large amount of private memory on Windows
Date: Thu, 17 Sep 2020 10:06:07 -0400
Message-ID: <146973.1600351567@sss.pgh.pa.us> (raw)
In-Reply-To: <CAH_oh=wk5i36whfUKhPvnTfR6KsU_CzRTXecNaAtY86HWb57YQ@mail.gmail.com>
References: <CAH_oh=wk5i36whfUKhPvnTfR6KsU_CzRTXecNaAtY86HWb57YQ@mail.gmail.com>
=?UTF-8?Q?=C3=98ystein_Kolsrud?= <kolsrud@gmail.com> writes:
> So my question is: When does a postgres process forked for a connection use
> private memory instead of shared, and what can I do to avoid this?
The only significant long-term consumption of private memory is for
caches. There are catalog caches, which can get large if the session
accesses a whole lot of database objects (e.g., thousands of different
tables). Some of the PLs maintain caches with parsed versions of any
function that's been executed. (An ex-employer of mine had a lot of
trouble in that regard, because they had hundreds of thousands of lines
worth of plpgsql functions.) There isn't any user-accessible knob for
limiting the size of those caches. If you have a problem of that sort,
about the only way to mitigate it is to use fewer backends so that the
total memory consumption stays in bounds, or redesign your application.
In some cases it might help to restart your sessions when they get too
big, but that seems like at best a band-aid.
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, kolsrud@gmail.com
Subject: Re: PostgreSQL processes use large amount of private memory on Windows
In-Reply-To: <146973.1600351567@sss.pgh.pa.us>
References: <CAH_oh=wk5i36whfUKhPvnTfR6KsU_CzRTXecNaAtY86HWb57YQ@mail.gmail.com> <146973.1600351567@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