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 1tGXpL-003e6A-4c for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Nov 2024 06:16:35 +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 1tGXpJ-0031nh-MN for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Nov 2024 06:16:33 +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 1tGXpI-0031nZ-JH for pgsql-hackers@lists.postgresql.org; Thu, 28 Nov 2024 06:16:33 +0000 Received: from mail.clear-code.com ([153.126.203.179]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tGXpD-004HjC-Vj for pgsql-hackers@postgresql.org; Thu, 28 Nov 2024 06:16:30 +0000 Received: from localhost (unknown [IPv6:2404:7a80:9f01:f500:af1b:fa00:91d6:aaa9]) by mail.clear-code.com (Postfix) with ESMTPSA id 2DCD4DE018; Thu, 28 Nov 2024 15:16:20 +0900 (JST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.clear-code.com 2DCD4DE018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=clear-code.com; s=default; t=1732774580; bh=sr9nQyOTUBOocXPjV75xVJqhe5sL1K/Q/l7NaaqXQgo=; h=Date:To:Cc:Subject:From:In-Reply-To:References:From; b=E1IUGYAmlsIl1Vh5oCiYuOhoaHdAwEakMcryBij3O8qYH4Nz4SXcFU8EBFhMXUKxZ LYKA9HNie/lDjoMocMzhph2dsi8QVVfq5NDXiZ3Ij4tnCZH22iG8BzS0IuN4EIqVP7 TjmIBOSTC+9kmMf+ulmFVz1S33yoYQaQ1hCQspS8= Date: Thu, 28 Nov 2024 15:16:17 +0900 (JST) Message-Id: <20241128.151617.1631851448884958406.kou@clear-code.com> To: zhjwpku@gmail.com Cc: sawada.mshk@gmail.com, michael@paquier.xyz, pgsql-hackers@postgresql.org Subject: Re: Make COPY format extendable: Extract COPY TO format implementations From: Sutou Kouhei In-Reply-To: References: <20241125.110620.313152541320718947.kou@clear-code.com> <20241125.150150.2272193296332028961.kou@clear-code.com> X-Mailer: Mew version 6.8 on Emacs 29.4 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [2.90 / 999.00]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; TAGGED_RCPT(0.00)[]; ARC_NA(0.00)[]; ASN(0.00)[asn:2518, ipnet:2404:7a80::/29, country:JP]; RCVD_COUNT_ZERO(0.00)[0]; MIME_TRACE(0.00)[0:+]; FREEMAIL_TO(0.00)[gmail.com]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[gmail.com,paquier.xyz,postgresql.org]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_NONE(0.00)[]; RCPT_COUNT_THREE(0.00)[4] X-Rspamd-Server: mail.clear-code.com X-Rspamd-Action: no action X-Rspamd-Queue-Id: 2DCD4DE018 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, In "Re: Make COPY format extendable: Extract COPY TO format implementations" on Wed, 27 Nov 2024 19:49:17 +0800, Junwang Zhao wrote: > I just gave this another round of benchmarking tests. I'd like to > share the number, > since COPY TO has some performance drawbacks, I test only COPY TO. I > use the run.sh Tomas provided earlier but use pgbench with a custom script, you > can find it here[0]. > > I tested 3 branches: > > 1. the master branch > 2. all v26 patch sets applied > 3. Emitting JSON to file using COPY TO v13 patch set[1], this add some > if branch in CopyOneRowTo, so I was expecting this slower than master > > 2 can be about -3%~+3% compared to 1, but what surprised me is that 3 > is always better than 1 & 2. > > I reviewed the patch set of 3 and I don't see any magic. > > You can see the detailed results here[2], I can not upload files so I > just shared the google doc link, ping me if you can not open the link. > > [0]: https://github.com/pghacking/scripts/tree/main/extensible_copy > [1]: https://www.postgresql.org/message-id/CACJufxH8J0uD-inukxAmd3TVwt-b-y7d7hLGSBdEdLXFGJLyDA%40mail.gmail.com > [2]: https://docs.google.com/spreadsheets/d/1wJPXZF4LHe34X9IU1pLG7rI9sCkSy2dEkdj7w7avTqM/edit?usp=sharing Thanks for sharing your numbers. 1. and 2. shows that there is at least no significant performance regression. I see the patch set of 3. and I think that the result (there is no performance difference between 1. and 3.) isn't strange. The patch set adds some if branches but they aren't used with "text" format at least in per row process. Thanks, -- kou