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 1pnjkn-0007cr-28 for pgsql-interfaces@arkaria.postgresql.org; Sat, 15 Apr 2023 17:32:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pnjkl-0005gB-N9 for pgsql-interfaces@arkaria.postgresql.org; Sat, 15 Apr 2023 17:31:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pnjkl-0005eI-Ee for pgsql-interfaces@lists.postgresql.org; Sat, 15 Apr 2023 17:31:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pnjki-00072c-M3 for pgsql-interfaces@postgresql.org; Sat, 15 Apr 2023 17:31:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 33FHVtLq2000625; Sat, 15 Apr 2023 13:31:55 -0400 From: Tom Lane To: Ernst-Georg Schmid cc: "pgsql-interfaces@postgresql.org" Subject: Re: C trigger significantly slower than PL/pgSQL? In-reply-to: <8306edcc-8458-44b3-485b-0725de3c7743@tuschehund.de> References: <1595558642.2519076.1681378287741@webmail.strato.de> <1342580.1681400531@sss.pgh.pa.us> <8306edcc-8458-44b3-485b-0725de3c7743@tuschehund.de> Comments: In-reply-to Ernst-Georg Schmid message dated "Fri, 14 Apr 2023 19:39:20 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2000623.1681579915.1@sss.pgh.pa.us> Date: Sat, 15 Apr 2023 13:31:55 -0400 Message-ID: <2000624.1681579915@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ernst-Georg Schmid writes: > I have still a follow-up question, though. Since I'm not calling > SPI_freeplan(), the cached plan lives forever, right? Till the per-session server process exits. I wouldn't call it a leak as long as you can reuse the plan in later calls in that session; a static variable's scope is fine for that. regards, tom lane