Re: Memory usage per session

From: AMatveev(at)bitec(dot)ru
To: Karl Czajkowski <karlcz(at)isi(dot)edu>
Cc: John McKown <john(dot)archie(dot)mckown(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Memory usage per session
Date: 2016-07-11 08:15:32
Message-ID: 409604420.20160711111532@bitec.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

> On Jul 08, John McKown modulated:
> ...
>> I think the "problem" that he is having is fixable only by changing how
>> PostgreSQL itself works. His problem is a PL/pgSQL function which is
>> 11K lines in length. When invoked, this function is "compiled" into a
>> large tokenized parse tree. This parse tree is only usable in the
>> session which invoked the the function. Apparently this parse tree
>> takes a lot of memory.

It's pleasant to see smart men, And I got here some help.
The most valuable is advice to deploy PgPool or PgBouncer.
Thanks guys. Usually, I don't answer on certain theme.
http://www.joelonsoftware.com/articles/fog0000000018.html
But may be it helps to somebody.

> Right. I'm not entirely sure the original poster wants to hear
> practical solutions,
Of course this answer requires "moral justification" :)

> but I think there are three ways that someone
> familar with Postgres would avoid this type of problem:

> 1. Connection pooling. Set the max connection limit and other tuning
> parameters appropriately for your workload and available
> resources. Don't get into a state as was described (thousands of
> open connections and only hundreds "active"). Make your client
> applications more disciplined.
You are joking :)
They pay us money, and they want easy and cheap decision :))
I can tell a terrible thing, but they can pay money to others :)))
> 2. Buy more RAM. You can easily grow to 512GB in just basic
> dual-socket servers these days. This hardware cost may well
> be worth it to avoid human labor costs.
Thanks cap :))
http://www.reduxsquad.com/wp-content/uploads/2016/02/hotels-com-spring-break-sale-captain-obvious-workout-bathroom-large-8.jpg
> 3. Rewrite or refactor such complex stored procedures in a different
> programming language such as C or Python, so your PL/pgsql stored
> procedures remain small glue around libraries of code. Postgres
> makes it very trivial to extend the system with such procedural
> libraries.
>
Let's read first :)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2016-07-11 09:03:53 Re: [BUGS] Where clause in pg_dump: need help
Previous Message arnaud gaboury 2016-07-11 08:00:50 Re: error when upgrading 9.4 to 9.5 manually