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 1rfwdZ-003GEd-TC for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Mar 2024 06:44:54 +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 1rfwdX-00Bw76-8S for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Mar 2024 06:44:51 +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 1rfwdW-00Bw6x-VJ for pgsql-hackers@lists.postgresql.org; Fri, 01 Mar 2024 06:44:51 +0000 Received: from mail.clear-code.com ([2401:2500:102:3039:153:126:206:245]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rfwdT-002Hgr-7w for pgsql-hackers@postgresql.org; Fri, 01 Mar 2024 06:44:50 +0000 Received: from localhost (unknown [IPv6:2404:7a80:89c1:1200:6af9:2266:1443:f149]) by mail.clear-code.com (Postfix) with ESMTPSA id CB44163B06A; Fri, 1 Mar 2024 15:44:43 +0900 (JST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.clear-code.com CB44163B06A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=clear-code.com; s=default; t=1709275484; bh=mGuDaegIzwjSl2I/OQO4M3BsJrIYXwj26RB8WdFTEDQ=; h=Date:To:Cc:Subject:From:In-Reply-To:References:From; b=tJlCbHkkqoUdKBqIBZyOCoAIZWwXhGqoil31VUQSmWSbm8snfLoaBGBpmBp1Y+n/D 2QhPnJwprQ/muArvC/C3s9lsNj9eOZ5sPfOeZLJJZISZKRLOjqwE50zU1BfF57UM/a /qOB8x6uOwA8dz7ydfg47u2RVQnL8oiXQKKwMgZE= Date: Fri, 01 Mar 2024 15:44:43 +0900 (JST) Message-Id: <20240301.154443.618034282613922707.kou@clear-code.com> To: michael@paquier.xyz 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 From: Sutou Kouhei In-Reply-To: References: <20240222.183948.518018047578925034.kou@clear-code.com> X-Mailer: Mew version 6.8 on Emacs 29.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Server: mail.clear-code.com X-Rspamd-Queue-Id: CB44163B06A X-Rspamd-Action: no action 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]; ARC_NA(0.00)[]; ASN(0.00)[asn:2518, ipnet:2404:7a80::/29, country:JP]; TAGGED_RCPT(0.00)[]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_COUNT_ZERO(0.00)[0]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; FUZZY_BLOCKED(0.00)[rspamd.com]; URIBL_BLOCKED(0.00)[postgresql.org:url,paquier.xyz:email,localhost:helo]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[anarazel.de,gmail.com,dunslane.net,postgresql.org]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; SURBL_MULTI_FAIL(0.00)[paquier.xyz:server fail,localhost:server fail,postgresql.org:server fail] 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 Fri, 1 Mar 2024 14:31:38 +0900, Michael Paquier wrote: > I guess so. It does not make much of a difference, though. The thing > is that the dispatch caused by the custom callbacks called for each > row is noticeable in any profiles I'm taking (not that much in the > worst-case scenarios, still a few percents), meaning that this impacts > the performance for all the in-core formats (text, csv, binary) as > long as we refactor text/csv/binary to use the routines of copyapi.h. > I don't really see a way forward, except if we don't dispatch the > in-core formats to not impact the default cases. That makes the code > a bit less elegant, but equally efficient for the existing formats. It's an option based on your profile result but your execution result also shows that v15 is faster than HEAD [1]: > I am getting faster runtimes with v15 (6232ms in average) > vs HEAD (6550ms) at 5M rows with COPY TO [1] https://www.postgresql.org/message-id/flat/ZdbtQJ-p5H1_EDwE%40paquier.xyz#6439e6ad574f2d47cd7220e9bfed3889 I think that faster runtime is beneficial than mysterious profile for users. So I think that we can merge v15 to master. Thanks, -- kou