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 1iqUlL-0001Nb-Ll for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jan 2020 04:22:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iqUkM-0006sD-2s for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jan 2020 04:21:06 +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 1iqUkL-0006s6-QR for pgsql-hackers@lists.postgresql.org; Sun, 12 Jan 2020 04:21:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iqUkJ-0004fJ-1m for pgsql-hackers@lists.postgresql.org; Sun, 12 Jan 2020 04:21:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 00C4KuIx007491; Sat, 11 Jan 2020 23:20:56 -0500 From: Tom Lane To: Tomas Vondra cc: Amit Kapila , Noah Misch , Amit Khandekar , Alvaro Herrera from 2ndQuadrant , Andres Freund , Juan =?utf-8?B?Sm9zw6kgU2FudGFtYXLDrWE=?= Flecha , PostgreSQL Hackers , Robert Haas , Thomas Munro Subject: Re: logical decoding : exceeded maxAllocatedDescs for .spill files In-reply-to: <20200112041008.gddmpqunowlklc24@development> References: <20200104185148.GA2270238@rfd.leadboat.com> <20200109053704.GA2502006@rfd.leadboat.com> <22498.1578548741@sss.pgh.pa.us> <14739.1578613901@sss.pgh.pa.us> <18117.1578616812@sss.pgh.pa.us> <20200112033930.6cy3n6ybft6pp7gw@development> <29690.1578801237@sss.pgh.pa.us> <20200112041008.gddmpqunowlklc24@development> Comments: In-reply-to Tomas Vondra message dated "Sun, 12 Jan 2020 05:10:08 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7489.1578802856.1@sss.pgh.pa.us> Date: Sat, 11 Jan 2020 23:20:56 -0500 Message-ID: <7490.1578802856@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tomas Vondra writes: > On Sat, Jan 11, 2020 at 10:53:57PM -0500, Tom Lane wrote: >> remind me where the win came from, exactly? > Well, the problem is that in 10 we allocate tuple data in the main > memory ReorderBuffer context, and when the transaction gets decoded we > pfree() it. But in AllocSet that only moves the data to the freelists, > it does not release it entirely. So with the right allocation pattern > (sufficiently diverse chunk sizes) this can easily result in allocation > of large amount of memory that is never released. > I don't know if this is what's happening in this particular test, but I > wouldn't be surprised by it. Nah, don't think I believe that: the test inserts a bunch of tuples, but they look like they will all be *exactly* the same size. CREATE TABLE decoding_test(x integer, y text); ... FOR i IN 1..10 LOOP BEGIN INSERT INTO decoding_test(x) SELECT generate_series(1,5000); EXCEPTION when division_by_zero then perform 'dummy'; END; regards, tom lane