Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXrrh-0003Ht-Vr for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Mar 2023 22:57:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXrrg-0006z3-T7 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Mar 2023 22:57:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXrrg-0006yp-Hz for pgsql-hackers@lists.postgresql.org; Thu, 02 Mar 2023 22:57:32 +0000 Received: from mail1.dalibo.net ([51.159.93.128] helo=mail.dalibo.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXrre-0003Yp-42 for pgsql-hackers@lists.postgresql.org; Thu, 02 Mar 2023 22:57:32 +0000 Received: from karst (larco.ioguix.net [78.202.0.6]) by mail.dalibo.com (Postfix) with ESMTPSA id 8F2BC1F7E0; Thu, 2 Mar 2023 23:57:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1677797842; bh=JDskJee/1mmmkgAmKmK8kjG9vOegM7ia25I5p1o+Xqo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DNif41+lHvUvv3GTsKEgkHEzkuiqpzgssaY+DJ49TyYWHqFeSETIkohGhqW+lzRaC haRBxKwdOiXvE8UNqKcsLJ5iQ3xk6f9VbqSBRoeZ+lohxHqJ3bnfWgjmp+a96daKHl QBniR2eh8KlmSMkaWXgOQQAe9DNcxeq1EIy/pbyo= Date: Thu, 2 Mar 2023 23:57:21 +0100 From: Jehan-Guillaume de Rorthais To: Tomas Vondra Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Memory leak from ExecutorState context? Message-ID: <20230302235721.54af8258@karst> In-Reply-To: References: <20230228190643.1e368315@karst> <45d453c8-b2d3-b477-36eb-32fdf4455f3c@enterprisedb.com> <20230301184840.0a897a80@karst> <3013398b-316c-638f-2a73-3783e8e2ef02@enterprisedb.com> <20230302001827.66e95dc3@karst> <41c5766d-ed71-b70c-bbbc-d3396c462d62@enterprisedb.com> <20230302130838.717e888d@karst> <77a96d42-00cb-2448-465a-aa1e92d00cac@enterprisedb.com> <20230302191530.781909fe@karst> Organization: Dalibo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2 Mar 2023 19:53:14 +0100 Tomas Vondra wrote: > On 3/2/23 19:15, Jehan-Guillaume de Rorthais wrote: ... > > There was some thoughts about how to make a better usage of the memory.= As > > memory is exploding way beyond work_mem, at least, avoid to waste it wi= th > > too many buffers of BufFile. So you expand either the work_mem or the > > number of batch, depending on what move is smarter. TJis is explained a= nd > > tested here: > >=20 > > https://www.postgresql.org/message-id/20190421161434.4hedytsadpbnglgk%4= 0development > > https://www.postgresql.org/message-id/20190422030927.3huxq7gghms4kmf4%4= 0development > >=20 > > And then, another patch to overflow each batch to a dedicated temp file= and > > stay inside work_mem (v4-per-slice-overflow-file.patch): > >=20 > > https://www.postgresql.org/message-id/20190428141901.5dsbge2ka3rxmpk6%4= 0development > >=20 > > Then, nothing more on the discussion about this last patch. So I guess = it > > just went cold. >=20 > I think a contributing factor was that the OP did not respond for a > couple months, so the thread went cold. >=20 > > For what it worth, these two patches seems really interesting to me. Do= you > > need any help to revive it? >=20 > I think another reason why that thread went nowhere were some that we've > been exploring a different (and likely better) approach to fix this by > falling back to a nested loop for the "problematic" batches. >=20 > As proposed in this thread: >=20 > https://www.postgresql.org/message-id/20190421161434.4hedytsadpbnglgk%40= development Unless I'm wrong, you are linking to the same =C2=ABfrustrated as heck!=C2= =BB discussion, for your patch v2-0001-account-for-size-of-BatchFile-structure-in-hashJo.pa= tch (balancing between increasing batches *and* work_mem). No sign of turning "problematic" batches to nested loop. Did I miss somethi= ng? Do you have a link close to your hand about such algo/patch test by any cha= nce? > I was hoping we'd solve this by the BNL, but if we didn't get that in 4 > years, maybe we shouldn't stall and get at least an imperfect stop-gap > solution ... I'll keep searching tomorrow about existing BLN discussions (is it block le= vel nested loops?). Regards,