Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tQyH2-006Pyc-Bw for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Dec 2024 00:32:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tQyH1-005qUH-Cf for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Dec 2024 00:32:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tQyH0-005qU8-Ue for pgsql-hackers@lists.postgresql.org; Fri, 27 Dec 2024 00:32:14 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tQyGz-000irr-0F for pgsql-hackers@lists.postgresql.org; Fri, 27 Dec 2024 00:32:13 +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 4BR0WBnE2024992; Thu, 26 Dec 2024 19:32:11 -0500 From: Tom Lane To: Michel Pelletier cc: Pavel Stehule , pgsql-hackers@lists.postgresql.org Subject: Re: Using Expanded Objects other than Arrays from plpgsql In-reply-to: References: <1342498.1729444411@sss.pgh.pa.us> <1445998.1729482404@sss.pgh.pa.us> <2062830.1729625620@sss.pgh.pa.us> <2265411.1729699470@sss.pgh.pa.us> <2354718.1729737539@sss.pgh.pa.us> <2581216.1729794746@sss.pgh.pa.us> <1948345.1730500073@sss.pgh.pa.us> <3797606.1732045516@sss.pgh.pa.us> <2811228.1734553329@sss.pgh.pa.us> <1355690.1734971201@sss.pgh.pa.us> Comments: In-reply-to Michel Pelletier message dated "Wed, 25 Dec 2024 12:25:18 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2024990.1735259531.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 26 Dec 2024 19:32:11 -0500 Message-ID: <2024991.1735259531@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michel Pelletier writes: > On Mon, Dec 23, 2024 at 8:26 AM Tom Lane wrote: >> 2. If the problem is primarily with passing the same object to >> multiple parameters of a function, couldn't you detect and optimize >> that within the function? > Ah that's a great idea, and it works beautifully! Now I can do an > efficient triangle count without even needing a function, see below > expand_matrix is only called once: Nice! > That pretty much resolves my main issues. I'm still in an exploratory > phase but I think this gets me pretty far. Is this something that has to > wait for 18 to be released? Also do you need any further testing or code > reviewing from me? Yeah, this is not the kind of change we would back-patch, so it'll have to wait for v18 (or later if people are slow to review it :-( ). I don't think there's anything more we need from you, though of course you should keep working on your code and report back if you hit anything that needs further improvement on our end. regards, tom lane