Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0BzF-00064D-CW for pgsql-bugs@arkaria.postgresql.org; Fri, 28 Oct 2016 18:34:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1c0BzE-0002YZ-Nw for pgsql-bugs@arkaria.postgresql.org; Fri, 28 Oct 2016 18:34:40 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c0BzD-0002Y5-O0 for pgsql-bugs@postgresql.org; Fri, 28 Oct 2016 18:34:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c0BzA-0007Du-6a for pgsql-bugs@postgresql.org; Fri, 28 Oct 2016 18:34:38 +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 u9SIYYLC007728; Fri, 28 Oct 2016 14:34:34 -0400 From: Tom Lane To: will.pearson@digital.cabinet-office.gov.uk cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14403: Large numbers of CREATE OR UPDATE function causes memory exhaustion In-reply-to: <20161028162317.15991.74004@wrigleys.postgresql.org> References: <20161028162317.15991.74004@wrigleys.postgresql.org> Comments: In-reply-to will.pearson@digital.cabinet-office.gov.uk message dated "Fri, 28 Oct 2016 16:23:17 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7726.1477679674.1@sss.pgh.pa.us> Date: Fri, 28 Oct 2016 14:34:34 -0400 Message-ID: <7727.1477679674@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org will.pearson@digital.cabinet-office.gov.uk writes: > [ lots-n-lots-of CREATE FUNCTION/execute function/DROP FUNCTION eat memory ] I think probably what's going on here is that plpgsql is creating cache entries for these functions on first execution, and not reclaiming them before end of session. I'm not terribly excited about adding overhead to make it keep track of DROP FUNCTION operations, because this coding style seems less than great anyway. Have you considered using DO blocks instead of short-lived functions? regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs