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 1ri7Is-00FDry-Db for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Mar 2024 06:32:31 +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 1ri7Iq-001jOd-QU for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Mar 2024 06:32:29 +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 1ri7Ip-001jEx-5L for pgsql-hackers@lists.postgresql.org; Thu, 07 Mar 2024 06:32:29 +0000 Received: from wfhigh3-smtp.messagingengine.com ([64.147.123.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ri7Ik-003DPr-1m for pgsql-hackers@postgresql.org; Thu, 07 Mar 2024 06:32:27 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.west.internal (Postfix) with ESMTP id 9273518000BE; Thu, 7 Mar 2024 01:32:18 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 07 Mar 2024 01:32:19 -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=fm1; t=1709793138; x=1709879538; bh=zadN3lhpCp nTyYzXiRNZZf7WFCSZoNQwaA88YbPPq7Y=; b=nWXIp6LELvcgiLLlb4F+qJypT2 zn6l8lPXaP695KDS3cj3K+XEi9+5GhlGFgOid4vtosjAAe4B9bmpLQwGjlAob4yA 5TLOM2U4+AwrRXnOfZtO7VZ8AQo55TCf6FW57CRBXNxgdMqUq3fj5xSpompb++vU PhXj5HIg8CU0HRu6cdbaaetyuG/HL+diR+ZnDKJ8oeKHiH0E1pnf928Bc8Daxl9t PbCD+CfzY2h1gGep9eieOAaQWux1ilQn8cQUwxeeOtSzdgMLHLFEBiNJYR6HZ4Nc FtwnH4tf6Ohe4j4fLO6aZWoGhprndvp4reYT8UMDE7QKKPEfexwlS0HmOU1A== 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= fm1; t=1709793138; x=1709879538; bh=zadN3lhpCpnTyYzXiRNZZf7WFCSZ oNQwaA88YbPPq7Y=; b=KXdxx5ISufh1x+MzM/5xtZGG1YVIrWmpKvPUllSGplZh tQR/PAUDJ88/EL74HuycJgHH0JZ+SHa02W7ByHdBFqfVA9Rsf2wcAatggv+QXCVR Ov4baadM0HkDeQ4jP8EWJCLRErIFn6+Rv/Wr7ZgO9FA25Kc0WnUFnKZRio/6Dw47 pOOyxSUfouj9xekDp+sVdRh2ursXWZtk7m20dmGMT9CfCcae6SLnMaYg1CG/FNqk CLZlGd/ZkswtjXKz7CrrfGy5onm+7ZdYy3n/QBxQ6d5E3cThUJIMeHa7RpoqavNL 6Myz3/zYSs40nPUG4BUucHEeyN9eorCw1S2CwclT1w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledriedvgdelhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdejtddmnecujfgurhepfffhvf evuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrh hnpeetleeifedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedvjeen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthh grvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 7 Mar 2024 01:32:14 -0500 (EST) Date: Thu, 7 Mar 2024 15:32:01 +0900 From: Michael Paquier To: Sutou Kouhei Cc: andres@anarazel.de, sawada.mshk@gmail.com, zhjwpku@gmail.com, andrew@dunslane.net, nathandbossart@gmail.com, pgsql-hackers@postgresql.org Subject: Re: Make COPY format extendable: Extract COPY TO format implementations Message-ID: References: <20240301.154443.618034282613922707.kou@clear-code.com> <20240304.141108.377465274442209834.kou@clear-code.com> <20240305.171808.667980402249336456.kou@clear-code.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pP5MQ/4OOIetQekP" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --pP5MQ/4OOIetQekP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Mar 06, 2024 at 03:34:04PM +0900, Michael Paquier wrote: > I am not sure that my schedule is on track to allow that for this > release, unfortunately, especially with all the other items to review > and discuss to make this thread feature-complete. There should be > a bit more than four weeks until the feature freeze (date not set in > stone, should be around the 8th of April AoE), but I have less than > the half due to personal issues. Perhaps if somebody jumps on this > thread, that will be possible.. While on it, here are some profiles based on HEAD and v17 with the previous tests (COPY TO /dev/null, COPY FROM data sent to the void). COPY FROM, text format with 30 attributes and HEAD: - 66.53% 16.33% postgres postgres [.] NextCopyFrom - 50.20% NextCopyFrom - 30.83% NextCopyFromRawFields + 16.09% CopyReadLine 13.72% CopyReadAttributesText + 19.11% InputFunctionCallSafe + 16.33% _start COPY FROM, text format with 30 attributes and v17: - 66.60% 16.10% postgres postgres [.] NextCopyFrom - 50.50% NextCopyFrom - 30.44% NextCopyFromRawFields + 15.71% CopyReadLine 13.73% CopyReadAttributesText + 19.81% InputFunctionCallSafe + 16.10% _start COPY TO, text format with 30 attributes and HEAD: - 79.55% 15.54% postgres postgres [.] CopyOneRowTo - 64.01% CopyOneRowTo + 30.01% OutputFunctionCall + 11.71% appendBinaryStringInfo 9.36% CopyAttributeOutText + 3.03% CopySendEndOfRow 1.65% int4out 1.01% 0xffff83e46be4 0.93% 0xffff83e46be8 0.93% memcpy@plt 0.87% pgstat_progress_update_param 0.78% enlargeStringInfo 0.67% 0xffff83e46bb4 0.66% 0xffff83e46bcc 0.57% MemoryContextReset + 15.54% _start COPY TO, text format with 30 attributes and v17: - 79.35% 16.08% postgres postgres [.] CopyOneRowTo - 62.27% CopyOneRowTo + 28.92% OutputFunctionCall + 10.88% appendBinaryStringInfo 9.54% CopyAttributeOutText + 3.03% CopySendEndOfRow 1.60% int4out 0.97% pgstat_progress_update_param 0.95% 0xffff8c46cbe8 0.89% memcpy@plt 0.87% 0xffff8c46cbe4 0.79% enlargeStringInfo 0.64% 0xffff8c46cbcc 0.61% 0xffff8c46cbb4 0.58% MemoryContextReset + 16.08% _start So, in short, and that's not really a surprise, there is no effect once we use the dispatching with the routines only when a format would want to plug-in with the APIs, but a custom format would still have a penalty of a few percents for both if bottlenecked on CPU. -- Michael --pP5MQ/4OOIetQekP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmXpX2EACgkQnvQgOdby QH3cWA//ZhdMCyZDn2JSqtSw2+xuHQTd/Yu33V3E6G4Xf4G4MrKMBnCRLFwMijHS 2bEPtbewn4i8wBk+nXseYluFDDBAMvswUEh/9GQnaHjfTcQQ664ky24oJkDwauBP oulSGh+0MbjbXR2Bs/usRvoJWu44r6OFZ80nOfovSBWUUjC/IsvGbORwc6lCoZG2 xc17yWu4ZeSKVnbc31rs4dSxnm7gpg2J31i3ncB9rT0hn+WA2LTAibhig3baNXSH aFs2nUc8JRx+LaTnpDd+EetnuC19/Hjhz/cakKGaiIWESix3HGlAbI7kDdOw+sht Msf9LBShLY5GpAeqDbd+wYMREZM1vW2KuSfHuPxYA3y8h1e5gQq/nSuddF5DSk+1 nRqZNDJr3doCEi8lWzrWr/ohE/NVYxImylaXVLdEuqb81NDebpZQhHMTeEE/SL99 g9AxtL/IFY1RL+FxSlCP8vk/JwJGqHrwSJnc0WHx/+60WCg2vWb+Q3aXBON4l+11 M2zXUE9aZMf1kzZ2pk108U/CjRWY56F8onBRdRUGoHs2T/MDtsKm6+NujlFkJAq/ +XdpJ8lZq7jhfQfDXdRJa6kzheLlIvwvZ9nSbfOkDms142XTxiwEkP71mz8czEc/ S9SDsy1VfsPEGYANhLFNu7MInshusgNgGJyEky/YT6+dVu1pA1g= =FaST -----END PGP SIGNATURE----- --pP5MQ/4OOIetQekP--