Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ggbvA-0004t6-4N for pgsql-general@arkaria.postgresql.org; Mon, 07 Jan 2019 20:54:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ggbv8-0004jA-Hr for pgsql-general@arkaria.postgresql.org; Mon, 07 Jan 2019 20:54:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ggbv8-0004j3-05 for pgsql-general@lists.postgresql.org; Mon, 07 Jan 2019 20:54:50 +0000 Received: from sonic307-3.consmr.mail.bf2.yahoo.com ([74.6.134.42]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ggbv4-0000CO-2p for pgsql-general@postgresql.org; Mon, 07 Jan 2019 20:54:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1546894482; bh=WdrH+v4I11YQkq+F6YwX1t2OmUW8uoDrHJo8kiuEnp8=; h=Date:From:To:Subject:References:From:Subject; b=UNlnkUnFndkhbM1cXd9hCm6YdXkhhqhYElNktpFEHlZ8Om4otC5jDRd9YgoRFeD2Lf6DVohU9P+f2Bln8ZvhjKbjREQQKnRvsNwPUhtfYnnggWRt5ptaO7Ej57CVb0VV/Jm3jKmEFqSNhK2uPxtOuzxTZCeuGsHXYnfga508gL+ZOQVZAD5aAVg6b0R6hQeQz/4mSN1nkcw8qKIEvaMA1OMcrhWOiMZ7yWBpgo/9rdozcq7Vxjxp8993FS40ogvcUqDD1oymjaxL0JiyhesmbqAFuJ+f5C94DmgbZQpyIVJONn6M80Fzl9bE1AH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6Zh7vF7CPe3 TpZDNcVB9C7oifvDAI7orLOHnGLc0TLYXCvhptzwXaeoppfCk835PX6qhemE.zVVLqg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.bf2.yahoo.com with HTTP; Mon, 7 Jan 2019 20:54:42 +0000 Date: Mon, 7 Jan 2019 20:54:41 +0000 (UTC) From: Thomas Carroll To: "pgsql-general@postgresql.org" , Laurenz Albe Message-ID: <1053026855.14476215.1546894481622@mail.yahoo.com> Subject: Re: Memory exhaustion due to temporary tables? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_14476214_609664349.1546894481620" References: <1053026855.14476215.1546894481622.ref@mail.yahoo.com> X-Mailer: WebService/1.1.12857 YMailNorrin Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0 Content-Length: 8776 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_14476214_609664349.1546894481620 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > In the meantime, you might think about switching over to some process > that doesn't create and drop the same table constantly.=C2=A0 Perhaps > along the lines of > create temp table if not exists tt_preTally (...) on commit delete rows; > if (tt_preTally contains no rows) then >=C2=A0 insert into tt_preTally select ... > end if; > This'd have the advantage of reducing catalog churn in other catalogs > besides pg_statistic, too. Just to close the loop, doing the CREATE TEMP TABLE IF NOT EXISTS etc. help= ed a lot.=C2=A0 Still a tiny increase in memory over time, but this is much= much better. Thanks for the help, and amazed at the responsiveness of Mr. Lane and this = community! Tom Carroll On Monday, December 10, 2018, 4:59:47 PM EST, Laurenz Albe wrote: =20 =20 Thomas Carroll wrote: > We have a situation where a long-persistent Postgres connection consumes = more > and more memory.=C2=A0 If ignored, we eventually get =E2=80=9CCannot allo= cate memory=E2=80=9D > errors in the Postgres log.=C2=A0 If still ignored, the box will eventual= ly crash. > This takes about 3 weeks to happen.=C2=A0 It issues a call to a single fu= nction > about once every 15 seconds.=C2=A0 What can I do to prevent this outcome? There should be a memory context dump in the log file. What does it look like? Yours, Laurenz Albe --=20 Cybertec | Startseite - Cybertec |=20 |=20 | |=20 Startseite - Cybertec The PostgreSQL Company CYBERTEC =E2=80=93 Ihr professioneller PostgreSQL-Pa= rtner f=C3=BCr Support, Consulting, Trainings, =E2=80=A6 s... | | | Thanks for your reply.=C2=A0 There are many memory context dumps ------=_Part_14476214_609664349.1546894481620 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
> In the meantime, you might think about switching ov= er to some process
> that doesn't create and drop the = same table constantly.  Perhaps
> along the lines= of

> create temp table if not exis= ts tt_preTally (...) on commit delete rows;

> if (tt_preTally contains no rows) then
>&nb= sp; insert into tt_preTally select ...
> end if;

> This'd have the advantage of reducing= catalog churn in other catalogs
> b= esides pg_statistic, too.

Just to close the loop, doing the CREATE TEMP TABLE IF NOT EXISTS etc. he= lped a lot.  Still a tiny increase in memory over time, but this is mu= ch much better.

Thanks f= or the help, and amazed at the responsiveness of Mr. Lane and this communit= y!

Tom Carroll

=20
=20 =20
On Monday, December 10, 2018, 4:59:47 PM EST, Laurenz A= lbe <laurenz.albe@cybertec.at> wrote:


Thomas Carroll wrote:

> We have a situation where a long-persistent Pos= tgres connection consumes more
> and more memory. = ; If ignored, we eventually get =E2=80=9CCannot allocate memory=E2=80=9D> errors in the Postgres log.  If still ignored, th= e box will eventually crash.
> This takes about 3 week= s to happen.  It issues a call to a single function
= > about once every 15 seconds.  What can I do to prevent this outco= me?


There should be a memory con= text dump in the log file.
What does it look like?

Yours,
Laurenz Albe
--

------=_Part_14476214_609664349.1546894481620--