pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: raf <raf@raf.org>
To: pgsql-general@lists.postgresql.org
Subject: Re: PostgreSQL processes use large amount of private memory on Windows
Date: Fri, 18 Sep 2020 10:45:29 +1000
Message-ID: <20200918004529.ejhcosjxthdkenoj@raf.org> (raw)
In-Reply-To: <146973.1600351567@sss.pgh.pa.us>
References: <CAH_oh=wk5i36whfUKhPvnTfR6KsU_CzRTXecNaAtY86HWb57YQ@mail.gmail.com>
	<146973.1600351567@sss.pgh.pa.us>

On Thu, Sep 17, 2020 at 10:06:07AM -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> =?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

For what it's worth, I have 171305 lines of plpgsql/sql
functions and it hasn't caused any problem on a server
with 4GB RAM. With a small number of long-lived
connections.

cheers,
raf






view thread (7+ messages)  latest in thread

Message-ID: <20200918004529.ejhcosjxthdkenoj@raf.org>
Permalink:  ../20200918004529.ejhcosjxthdkenoj@raf.org/
Also on:    postgresql.org/message-id/20200918004529.ejhcosjxthdkenoj@raf.org

 · 

reply

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: raf@raf.org
  Subject: Re: PostgreSQL processes use large amount of private memory on Windows
  In-Reply-To: <20200918004529.ejhcosjxthdkenoj@raf.org>
  References: <CAH_oh=wk5i36whfUKhPvnTfR6KsU_CzRTXecNaAtY86HWb57YQ@mail.gmail.com> <146973.1600351567@sss.pgh.pa.us> <20200918004529.ejhcosjxthdkenoj@raf.org>

* 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