Re: BUG #14234: PostgreSQL consuming large amount of memory for persistent connection - Mailing list pgsql-bugs

From Pavel Stehule
Subject Re: BUG #14234: PostgreSQL consuming large amount of memory for persistent connection
Date
Msg-id CAFj8pRDA2DkF==ZgYDDfbg3-diCibRJFxY07VjJUpjOOaRAPDA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #14234: PostgreSQL consuming large amount of memory for persistent connection  (德哥 <digoal@126.com>)
List pgsql-bugs
Hi

2016-07-08 7:11 GMT+02:00 =E5=BE=B7=E5=93=A5 <digoal@126.com>:

>
> HI,
>    This is a reproduce method for why PostgreSQL session cann't release
> memory.
>    I have another case, has the same problem.
>    so i don't known why postgres cann't release memory? or can you explai=
n
> these memory contain which objects? why use this design?
> best regards,
> digoal
>

Every PostgreSQL session holds system data in own cache. Usually this cache
is pretty small (for significant numbers of users). But can be pretty big
if your catalog is untypically big and you touch almost all objects from
catalog in session. A implementation of this cache is simple - there is not
delete or limits. There is not garabage collector (and issue related to
GC), what is great, but the long sessions on big catalog can be problem.
The solution is simple - close session over some time or over some number
of operations. Then all memory in caches will be released.

Regards

Pavel



>
>
>
> --
> =E5=85=AC=E7=9B=8A=E6=98=AF=E4=B8=80=E8=BE=88=E5=AD=90=E7=9A=84=E4=BA=8B,=
I'm Digoal,Just Do It.
>
>
> At 2016-07-08 10:01:18, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
> >digoal@126.com writes:
> >> why PostgreSQL session do not release these memory?
> >> it will comsume these memory until disconnect.
> >
> >Your session has created and accessed 100000 tables plus 100000 views.
> >I do not think you should complain if that takes a great deal of memory.
> >Either rethink why you need so many tables, or buy hardware commensurate
> >with the size of your problem.
> >
> >            regards, tom lane
>
>

pgsql-bugs by date:

Previous
From: 德哥
Date:
Subject: Re: BUG #14234: PostgreSQL consuming large amount of memory for persistent connection
Next
From: Marco Nenciarini
Date:
Subject: Re: BUG #14230: Wrong timeline returned by pg_stop_backup on a standby