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 1gWVVQ-0005nx-Hj for pgsql-general@arkaria.postgresql.org; Tue, 11 Dec 2018 00:02:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gWVVP-0004De-22 for pgsql-general@arkaria.postgresql.org; Tue, 11 Dec 2018 00:02:31 +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 1gWVVO-0004DB-P4 for pgsql-general@lists.postgresql.org; Tue, 11 Dec 2018 00:02:30 +0000 Received: from sonic314-14.consmr.mail.bf2.yahoo.com ([74.6.132.124]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gWVVL-0008UP-PD for pgsql-general@postgresql.org; Tue, 11 Dec 2018 00:02:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1544486545; bh=Tv7G1/BbyDqYL4TCDy3lm2v0vBszODUVDdTJuxSrbn8=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject; b=fMZ8zCdM0ybNkUO68DeHg9p9ebzl2JrMPE1s0hUJyKMLGUhiOpIGpgT12JgK+/4kcfti2fz7zlnQbYG/tcg275hWQ9cqJtoak77JFaGK4hwEsCkNQIJL01CJlbDYFAFcusLkLuiNIK85zzUm+dQi/qddVXThuvAin4PFvvkdA1CO/qpxNkya+pm+6Yao8HFItYNJHDCWF4m9+8nql3ou+ag8fIY5y+GmOL23Q82FkxIHiDq24nCeyzBqzs96i4wq9WMYjZABwjT70xsxy6mrC2XV9romymJBPQ0rC3yJQ+n/SahUKMczvTmXL510TtKF1/tVaK5yLgRy6HBkKzdv1A== X-YMail-OSG: Iw6mCP4VM1mnKHjoXK.MKBuzHX1xy_mtryiClZr2YCnDinxAewaXMQP_7QUHwKy cjuSprh4chnzUqaWY7VqwDdcWcUqdBDU3ajWXb0G5YatMwwr5QdWjgdT_1mXxFKWYrSqBdNUaAbx P4H1C_6FtGkQph8g4cGlKwz791w0iHmh7aX5cyt4lm3SD0ifztwPI72kPhsHnBQHdNPGfgZ1SkHq k62YkrUbPQyurTQx4ymSDUVXBu6z4p7zMtJulyzYMIdDplvl5wWTRxDQsiUHQ7BSkeMJDIWF7F7I KeI1hbDVj7NfdxCk7E6LsbKcsbHsFVUiSSQcI.mCWHFMIOBH0UioB73xMyhIZoWCqMoeekMXfa8Z gXPIeovDuI.ViFnD..J15Pu1sxdI4q2I9m.1_DFp02T4g_ETlAkREhLXzJoWigIixmqLwj9NfOiy zYTv2JGXXOrwM0KSNsq_MzfSyUS2RgEDFZ.HtgG9uCAIMjR0fSkzIktXLqJHWyWmejM2UMts5UKd Jt17BXY1dClD4I3c0oGseRGwyTBjwRrVROuC4M0P4LHTgk9ada9nqcYTPkMZiPNn2LvsI81ywRg_ K2A.IRmIjoNl0Im5Ei5Yv6TIqCLEoqaWqC0K0zmUMRNBcDgJqzrwA1L4PoUcf__G9r.yAu6mUpfX SLS75eg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.bf2.yahoo.com with HTTP; Tue, 11 Dec 2018 00:02:25 +0000 Date: Tue, 11 Dec 2018 00:01:10 +0000 (UTC) From: Thomas Carroll To: Tom Lane Cc: "pgsql-general@postgresql.org" Message-ID: <1761071676.2037719.1544486470070@mail.yahoo.com> In-Reply-To: <7049.1544482214@sss.pgh.pa.us> References: <2114009259.1866365.1544469996900.ref@mail.yahoo.com> <2114009259.1866365.1544469996900@mail.yahoo.com> <2584.1544474727@sss.pgh.pa.us> <1497611735.1978595.1544479049695@mail.yahoo.com> <7049.1544482214@sss.pgh.pa.us> Subject: Re: Memory exhaustion due to temporary tables? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2037718_941349492.1544486470068" X-Mailer: WebService/1.1.12857 YMailNorrin Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0 Content-Length: 12993 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_2037718_941349492.1544486470068 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =20 On Monday, December 10, 2018, 5:50:22 PM EST, Tom Lane wrote: =20 > Is the error message spelling really exactly "Cannot allocate memory"? Yes - but I think the message is forwarded from Linux.=C2=A0 Here is an exa= mple: 2018-12-08 00:00:00.070 EST,,,32506,,5bc71a25.7efa,25643,,2018-10-17 07:16:= 53 EDT,,0,LOG,00000,"could not fork autovacuum worker process: Cannot alloc= ate memory",,,,,,,,,"" Should have been more thoughtful in what I chose to mention.=C2=A0 Here is = one that may be more familiar, and directly related to the issue I am encou= ntering: 2018-12-08 00:00:03.642 EST,"schema_name","db_name",24949,"10.12.113.56:501= 38",5bfed8cd.6175,17637,"SELECT",2018-11-28 13:05:01 EST,24/223502,0,ERROR,= 53200,"out of memory","Failed on request of size 24.",,,,"SQL statement ""C= REATE TEMPORARY TABLE table_name ON COMMIT DROP AS > Also, as mentioned upthread, it'd be interesting to see if there's > a memory context dump showing up in your server log. There are many memory context dumps, and they are long (well over 100 lines= apiece).=C2=A0 To me these are unfamiliar and hard to read, but I tried to= pick one that referenced all the same tables used in the function.=C2=A0 I= put one such dump (188 lines) here: tc.log |=20 |=20 |=20 | | | | | |=20 | |=20 tc.log | | | A hopefully-helpful short excerpt from the top: TopMemoryContext: 174216 total in 7 blocks; 12520 free (27 chunks); 161696 = used =C2=A0 pgstat TabStatusArray lookup hash table: 8192 total in 1 blocks; 632= free (0 chunks); 7560 used =C2=A0 TopTransactionContext: 24576 total in 2 blocks; 7288 free (3 chunks)= ; 17288 used =C2=A0=C2=A0=C2=A0 Combo CIDs: 8192 total in 1 blocks; 1800 free (0 chunks)= ; 6392 used =C2=A0=C2=A0=C2=A0 ExecutorState: 8192 total in 1 blocks; 7400 free (0 chun= ks); 792 used =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ExprContext: 0 total in 0 blocks; 0 free (0 = chunks); 0 used =C2=A0=C2=A0=C2=A0 SPI Exec: 2088960 total in 8 blocks; 865976 free (7 chun= ks); 1222984 used =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ExecutorState: 262216 total in 6 blocks; 943= 44 free (11 chunks); 167872 used =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 HashTableContext: 8192 total in = 1 blocks; 7584 free (0 chunks); 608 used =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 HashBatchContext: 19= 7104 total in 6 blocks; 0 free (0 chunks); 197104 used =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 HashTableContext: 8192 total in = 1 blocks; 7968 free (0 chunks); 224 used =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 HashBatchContext: 49= 240 total in 2 blocks; 8136 free (0 chunks); 41104 used =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 HashTableContext: 8192 total in = 1 blocks; 7584 free (0 chunks); 608 used =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 HashBatchContext: 19= 7104 total in 6 blocks; 0 free (0 chunks); 197104 used Anything I can do to zero in on helpful information, I'm all ears. Thanks so much!Tom =20 ------=_Part_2037718_941349492.1544486470068 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


=20
On Mo= nday, December 10, 2018, 5:50:22 PM EST, Tom Lane <tgl@sss.pgh.pa.us>= wrote:

> Is the error message = spelling really exactly "Cannot allocate memory"?
Yes - but I think the message is forwarded from L= inux.  Here is an example:

2018-12-08 00:00:00.070 EST,,,32506,,5bc71a25.7e= fa,25643,,2018-10-17 07:16:53 EDT,,0,LOG,00000,"could not fork autovacuum w= orker process: Cannot allocate memory",,,,,,,,,""
<= span>
Should have been more t= houghtful in what I chose to mention.  Here is one that may be more fa= miliar, and directly related to the issue I am encountering:

20= 18-12-08 00:00:03.642 EST,"schema_name","db_name",24949,"10.12.113.56:50138= ",5bfed8cd.6175,17637,"SELECT",2018-11-28 13:05:01 EST,24/223502,0,ERROR,53= 200,"out of memory","Failed on request of size 24.",,,,"SQL statement ""CRE= ATE TEMPORARY TABLE table_name ON COMMIT DROP AS

> Al= so, as mentioned upthread, it'd be interesting to see if there's
> a memory context= dump showing up in your server log.
<= span>
There are many memory context dumps, and = they are long (well over 100 lines apiece).  To me these are unfamilia= r and hard to read, but I tried to pick one that referenced all the same ta= bles used in the function.  I put one such dump (188 lines) here:




A hopefull= y-helpful short excerpt from the top:

TopMemoryCon= text: 174216 total in 7 blocks; 12520 free (27 chunks); 161696 used
&nbs= p; pgstat TabStatusArray lookup hash table: 8192 total in 1 blocks; 632 fre= e (0 chunks); 7560 used
  TopTransactionContext: 24576 total in 2 b= locks; 7288 free (3 chunks); 17288 used
    Combo CIDs: 8= 192 total in 1 blocks; 1800 free (0 chunks); 6392 used
   = ; ExecutorState: 8192 total in 1 blocks; 7400 free (0 chunks); 792 used
=       ExprContext: 0 total in 0 blocks; 0 free (0 = chunks); 0 used
    SPI Exec: 2088960 total in 8 blocks; = 865976 free (7 chunks); 1222984 used
      Exec= utorState: 262216 total in 6 blocks; 94344 free (11 chunks); 167872 used        HashTableContext: 8192 total in= 1 blocks; 7584 free (0 chunks); 608 used
     =      HashBatchContext: 197104 total in 6 blocks; 0 free= (0 chunks); 197104 used
        Hash= TableContext: 8192 total in 1 blocks; 7968 free (0 chunks); 224 used
&nb= sp;         HashBatchContext: 49240= total in 2 blocks; 8136 free (0 chunks); 41104 used
   &= nbsp;    HashTableContext: 8192 total in 1 blocks; 7584 free= (0 chunks); 608 used
        &n= bsp; HashBatchContext: 197104 total in 6 blocks; 0 free (0 chunks); 197104 = used


Anything I can do to zero in on helpful i= nformation, I'm all ears.

Thanks so much!
Tom



------=_Part_2037718_941349492.1544486470068--