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 1rNSJv-00CDzk-RH for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jan 2024 06:44:13 +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 1rNSJu-000shq-V3 for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jan 2024 06:44:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rNSGp-000oml-Ob for pgsql-hackers@lists.postgresql.org; Wed, 10 Jan 2024 06:41:00 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rNSGl-000me9-T5 for pgsql-hackers@postgresql.org; Wed, 10 Jan 2024 06:40:59 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.nyi.internal (Postfix) with ESMTP id 6211E5C00C9; Wed, 10 Jan 2024 01:40:52 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 10 Jan 2024 01:40:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1704868852; x=1704955252; bh=PNUUoMTvOR V2bEfsgf3fbGVViUsIJCKe1JDbn14p8Uw=; b=UHxkhdqmit5KEZD+Lvu/bzwaDj Vvp6tdImytfrN+NubnjM60anzS+rtfBFTJ81jXMKz3Y/7cpXj+6Mb2VlEcHC0jsW QFd2BSHCcV40kZdCPxz8XByeyQeNL7wEW5Y7RGqKPloQCgKCYxJrNQ39a6Ts/MuG OesNVgMCN288qB0J5r1Ln9etOyPZcQYXlLFJD6Kza7quzgD912cP2v5jibJ3KOFK ushBW5PmOlMMXcbQieLoQdzSUv68Wg/ypLPnS7FnlmxXnLwJnWWDZw828YxV99Te zrJcB6CGWVHFw+fa424rFhotIoc3YT0pWtLJCx8CJIjKedPsNhoz3fYCjcwQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1704868852; x=1704955252; bh=PNUUoMTvORV2bEfsgf3fbGVViUsI JCKe1JDbn14p8Uw=; b=teef/UKCyxqHRfOegHCzyvIvD1R2ppV8STDdBtePBWYX pDrAFM8Hhq7N628rDTkEfe7ZH8QXTwl5MxfJ3IEhx+7tOj/NDEeGoJWPAGT1n/UG 52I2NDizdScY7dW3skYNUxQR0Ellfug9n4XLaVDCnjLVlu7lVUiJchfzLIO1mp5Q UylGMyndkMMEPvoe71l7npKPezNOwnWtHvP62Z5pqjYU4R8i5EPFmSTvUSDgXfJ4 Phfy3CbGEVrFvJKVmH/w4zILLmrCc49gztf1qsJDJKksVUjkjncw+dmJG+4peRGv 1rJE8xWQ3Md62OLT0gHYdvRrxxzb4L92r0ueNDVK7Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeitddgleekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Jan 2024 01:40:49 -0500 (EST) Date: Wed, 10 Jan 2024 15:40:36 +0900 From: Michael Paquier To: Jelte Fennema-Nio Cc: Anthonin Bonnefoy , Anton Kirilov , Alvaro Herrera , Robert Haas , pgsql-hackers@postgresql.org Subject: Re: Add PQsendSyncMessage() to libpq Message-ID: References: <202311081620.s2a7ao5jtlpe@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="VtOlmxVeT9DqXv53" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --VtOlmxVeT9DqXv53 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 31, 2023 at 09:37:31AM +0900, Michael Paquier wrote: > On Fri, Dec 29, 2023 at 12:52:30PM +0100, Jelte Fennema-Nio wrote: >> Those are some nice improvements. And I think once this patch is in, >> it would make sense to add the pgbench feature you're suggesting. >> Because indeed that makes it see what perf improvements can be gained >> for your workload. >=20 > Yeah, that sounds like a good idea seen from here. (Still need to > look at the core patch.) PQpipelineSync(PGconn *conn) +{ + return PQsendPipelineSync(conn) && pqFlush(conn) >=3D 0; +} [...] + * Give the data a push if we're past the size threshold. In nonblock + * mode, don't complain if we're unable to send it all; the caller is + * expected to execute PQflush() at some point anyway. */ - if (PQflush(conn) < 0) + if (pqPipelineFlush(conn) < 0) goto sendFailed; I was looking at this patch, and calling PQpipelineSync() would now cause two calls of PQflush() to be issued when the output buffer threshold has been reached. Could that lead to regressions? A second thing I find disturbing is that pqAppendCmdQueueEntry() would be called before the final pqFlush(), which could cause the commands to be listed in a queue even if the flush fails when calling PQpipelineSync(). Hence, as a whole, wouldn't it be more consistent if the new PQsendPipelineSync() and the existing PQpipelineSync() call an internal static routine (PQPipelineSyncInternal?) that can switch between both modes? Let's just make the extra argument a boolean. -- Michael --VtOlmxVeT9DqXv53 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmWeO+QACgkQnvQgOdby QH0P0hAAm287xtErkDzwfEZXIlOQmIqSVr6OeYxUPEQZaJ/MFopTghA1h/8d8VSV lZkRsFFNtcmpK2InK/dxaFYDAiPLDdL+XEYjD/704fXBYv7467rFWyM1TsY41zpt A7v09s7NAlrX9PIk6ON8vEB6HPZ6+IQVzPFxbzqz3/RF7D9JH7hordHsoSWzewqK rSEJmFB6FXP9Oook1ktboAifDkiB3DjKm5Dhcm69QTTL1wEW+9CsppPbl/VTxjCN +u9JyxCveWWvx+05QcTdqwzNA3eX0ScKwGb6yDu93zalAXd8a/FlRetrfT7STtOz oQaff2uINGLR6ks3ZTbHXS4AlUdJUWVJmoPVTtxclxOPP1OBtBcbNI5iYsHChM6D pIVDElyLougr/ESNVnmRasZHPw2aEbF2wihlVCNFsjWJgXOO4T7hPXvBFgOtDdHH Ody6hEXjg3zdVICy0eTHq2jYu4qU5O8aALh005IKr+vf3zMnXAxriK3UifaWI3Ac NqiM33yJg4O2OthiQkmzD4tPNBlowUCIgv0mAkUemnagNhTHrTqXByGG7enSEHPO oEUPZWyO8PtuSdF4WUOfWGgRoid7KYZVvuGNwW76vNojtHjZjNXd8kRKn8x7+g4p /zHwIaUj3Bk8B64jSva6oThiQWWI7zByRKxu4ajBn2ly5mpUGxo= =zyYL -----END PGP SIGNATURE----- --VtOlmxVeT9DqXv53--