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 1l4M08-0002Xf-Hl for pgsql-committers@arkaria.postgresql.org; Tue, 26 Jan 2021 10:55:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l4M05-0006MY-Dv for pgsql-committers@arkaria.postgresql.org; Tue, 26 Jan 2021 10:55:09 +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 1l4M03-0006MR-Va for pgsql-committers@lists.postgresql.org; Tue, 26 Jan 2021 10:55:09 +0000 Received: from [64.147.123.21] (helo=wout5-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4Lzz-0002uD-WB for pgsql-committers@lists.postgresql.org; Tue, 26 Jan 2021 10:55:07 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 45E7BA8B; Tue, 26 Jan 2021 05:54:51 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 26 Jan 2021 05:54:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=acMgQ7q2HJuoxaqY7jZwTNprHnD rjxKJVhPjeGFwxVU=; b=A+dziKyuupegcQpo8Egr3k9DpXabVVRsyRwusDxJuCl JiIPfrkipV2D8eVaEuv10E0O+i9EchafoklwtPWjvIfXpRSWNh3p3rr68TAZGLqn szqS5fhyVEStUOFnDcRuQQswA+UOlD/mKd6IlfPQKs75cr7qzPiIV0w0Vn98Byeb sn+GibeJPArbxmkbi5xmhiZg4NRTvbcEUUoa3hiAWcJd9CC6SyNds5yyR8L6i5cP 7id/0S7wajy32jAa3E/hXGplzxvMCTWAeVvtS3r0V/cNQ6bIh0GQOCDWnqHGFNqn qt6pTPu8ybokd+vD1yppc2OFFN+oBm+cHf64PdybFfQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=acMgQ7 q2HJuoxaqY7jZwTNprHnDrjxKJVhPjeGFwxVU=; b=N1WRypjuPpam2jzkhCpdO0 JfrvbK2Rnmlalah77xOqRmS8Q4m0AyEF13Sp96VZ2+0gmoDaNQY88Fl3n7qNDwN/ +cU2XjMjPOvmPMDeyTFU61pX1VYq95lc2bVeYgtZSHXimiQu6WyF1avvPPoREmw3 a0EKFTWefsbH1J7HQZUqR/IVE8Vi9wmSPI2PwZUiabmtRFS4XkMqyFfOGjxUDriJ yra6226E/fCtfo5TD3f24PjN9vtet7DoldbxVA3YxOvoPAlSHFOgZTKa0uqRvnR6 e+Pzfv4isLKPmsyTDRpxbXkdTza+gJJYgkXy8YXhm6ydt5xbM4nNCUDAGGovLYeA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdehgddvvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdefhedmnecujfgurhepfffhvf fukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhi vghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnh epffdufeeflefghfekudekkeevvddugfeiteekkeduleefvefhhffftdduffeiuedtnecu ffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucfkphepudduuddruddtvddrud ektddrudekheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 6D79D1080057; Tue, 26 Jan 2021 05:54:49 -0500 (EST) Date: Tue, 26 Jan 2021 19:54:46 +0900 From: Michael Paquier To: Tom Lane Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Improve performance of repeated CALLs within plpgsql procedures. Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="uWeTmGlFyjPfq7px" Content-Disposition: inline In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.21 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --uWeTmGlFyjPfq7px Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Tom, On Tue, Jan 26, 2021 at 03:28:39AM +0000, Tom Lane wrote: > Improve performance of repeated CALLs within plpgsql procedures. >=20 > This patch essentially is cleaning up technical debt left behind > by the original implementation of plpgsql procedures, particularly > commit d92bc83c4. That patch (or more precisely, follow-on patches > fixing its worst bugs) forced us to re-plan CALL and DO statements > each time through, if we're in a non-atomic context. That wasn't > for any fundamental reason, but just because use of a saved plan > requires having a ResourceOwner to hold a reference count for the > plan, and we had no suitable resowner at hand, nor would the > available APIs support using one if we did. While it's not that > expensive to create a "plan" for CALL/DO, the cycles do add up > in repeated executions. lapwing is generating a warning here: https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=3Dlapwing&dt= =3D2021-01-26%2010%3A40%3A09&stg=3Dmake pl_handler.c: In function 'plpgsql_call_handler': pl_handler.c:303:2: error: 'retval' may be used uninitialized in this function [-Werror=3Dmaybe-uninitialized] pl_handler.c:228:8: note: 'retval' was declared here -- Michael --uWeTmGlFyjPfq7px Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmAP9PYACgkQnvQgOdby QH2F1w/+LJOQhU/UHnwtv8DgkBXmqX72aGzD9h1OeFLqe7Swt9wDbf4mrlawUz8Z axoD3QE2zKdWmT2E0AAedp68/TWHW7bv18dW3ZkWTYlLw8Z0+t2MZzCTGdXVEA0t SnV+k/mGiV8azMqV1zWzR6cKniAErtJmOo2VbbVYrOs1JntVck4HklwZdJ/0Tq// 1O0CnllTqcjHrdE6HqnCLV0N6dBhzq8EjADEgd+oS/Nllh85SJngM/4AOGMzQ00H CAW9nGkgbVdYI6aYICsJLDk8BIwH9SVlwPouFUCzJ/yfzQHRXLYEy+a6uG1Rd535 C9QIY4z41SyTE2KoIyM7cCrfMsQWR/IsqMikQCVU/yHmhJ6xxGFluzc3s5NL7P1a XLnFwU9eIK9CSL/GReiRzTvvheDqq4Yg/9fBPbi2wqkGnlRv6iqN/yAmtIurx4C9 zhguDp3/aCFXyyR6s6cZRB5IYXyurwSnloEJB4KT3o27eriKowuMosZDCwHcrTRs sDD4JD72uU5WW+rQwH8h8AOccGItSQY06M5PnUVlyzorWS8gfWarjYZlqF045Shb Bm+ER4Qg70pbaW1tBQsSwtZy21pusNr6yx87FIml3HXdM9wSVKNgaVpuANkQ9HEP NA2Pq/molyvRmYsgiwHSdYXJvrhknquLG85VVI1CK+7yvOhUurU= =092B -----END PGP SIGNATURE----- --uWeTmGlFyjPfq7px--