Re: PostgreSQL processes use large amount of private memory on Windows

From: raf <raf(at)raf(dot)org>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL processes use large amount of private memory on Windows
Date: 2020-09-18 00:45:29
Message-ID: 20200918004529.ejhcosjxthdkenoj@raf.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

> =?UTF-8?Q?=C3=98ystein_Kolsrud?= <kolsrud(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Yessica Brinkmann 2020-09-18 02:26:34 Re: Problems with MemoryContextSwitchTo ()
Previous Message Shaozhong SHI 2020-09-17 23:04:10 Postgres as a service for supporting common application users