Re: BUG #14234: PostgreSQL consuming large amount of memory for persistent connection

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: 德哥 <digoal(at)126(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14234: PostgreSQL consuming large amount of memory for persistent connection
Date: 2016-07-08 06:08:16
Message-ID: CAFj8pRDA2DkF==ZgYDDfbg3-diCibRJFxY07VjJUpjOOaRAPDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi

2016-07-08 7:11 GMT+02:00 德哥 <digoal(at)126(dot)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 explain
> 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

>
>
>
> --
> 公益是一辈子的事,I'm Digoal,Just Do It.
>
>
> At 2016-07-08 10:01:18, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >digoal(at)126(dot)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
>
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Francisco Olarte 2016-07-08 09:37:09 Re: [BUGS] Where clause in pg_dump: need help
Previous Message 德哥 2016-07-08 05:11:52 Re: BUG #14234: PostgreSQL consuming large amount of memory for persistent connection