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 1uwAll-006sPL-DZ for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Sep 2025 02:41:14 +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 1uwAlk-00GE24-Kz for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Sep 2025 02:41:13 +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 1uwAlj-00GE1w-HV for pgsql-hackers@lists.postgresql.org; Wed, 10 Sep 2025 02:41:12 +0000 Received: from mail.clear-code.com ([153.126.203.179]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uwAle-001a6p-0i for pgsql-hackers@postgresql.org; Wed, 10 Sep 2025 02:41:11 +0000 Received: from localhost (unknown [IPv6:2404:7a80:9f01:f500:5950:362a:f311:d0d2]) by mail.clear-code.com (Postfix) with ESMTPSA id 6F9DA6210A0; Wed, 10 Sep 2025 11:41:00 +0900 (JST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.clear-code.com 6F9DA6210A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=clear-code.com; s=default; t=1757472060; bh=Z1uJe8eWRptNSVko9Ir9AuM+zacJjoqVMWfsyhect1Q=; h=Date:To:Cc:Subject:From:In-Reply-To:References:From; b=KTsiWfTh6zpRTCGZHPTI7JHuAepu+kon93A/H6l0TfYh/sE7Y20MeykCVvrQ75xD7 K1P0m62ifV7Drpt0rIPAMyHmCLTjusCzceYxfbzDhq2UsCh76Oqk7qcH0KyZZFLnLn REpFZ0rNAifd400bMpHyjGxwfCTY5ALhf0sYgyyA= Date: Wed, 10 Sep 2025 11:40:58 +0900 (JST) Message-Id: <20250910.114058.944005985178219874.kou@clear-code.com> To: sawada.mshk@gmail.com Cc: michael@paquier.xyz, david.g.johnston@gmail.com, tgl@sss.pgh.pa.us, zhjwpku@gmail.com, pgsql-hackers@postgresql.org Subject: Re: Make COPY format extendable: Extract COPY TO format implementations From: Sutou Kouhei In-Reply-To: References: <20250909.115014.143895394711134404.kou@clear-code.com> X-Mailer: Mew version 6.8 on Emacs 30.1 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)[paquier.xyz,gmail.com,sss.pgh.pa.us,postgresql.org]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_NONE(0.00)[]; RCPT_COUNT_FIVE(0.00)[6] X-Rspamd-Server: mail.clear-code.com X-Rspamd-Action: no action X-Rspamd-Queue-Id: 6F9DA6210A0 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 Tue, 9 Sep 2025 13:15:43 -0700, Masahiko Sawada wrote: >> I don't object your approach but we need a good way to >> measure performance. If we use this approach, we can omit it >> for now and we can revisit your approach later without >> breaking compatibility. How about using this approach if we >> can't find a good way to measure performance? > > I think it would be better to hear more opinions about this idea and > then make a decision, rather than basing our decision on whether or > not we can measure its performance, so we can be more confident in the > idea we have chosen. While this idea has the above downside, it could > make sense because we always allocate the entire CopyFrom/ToStateData > even today in spite of some fields being not used at all in binary > format and it requires less implementation costs to hide the > for-core-only fields. On the other hand, another possible idea is that > we have three different structs for categories 1 (core-only), 2 (core > and extensions), and 3 (extension-only), and expose only 2 that has a > void pointer to 3. The core can allocate the memory for 1 that embeds > 2 at the beginning of the fields. While this design looks cleaner and > we can minimize overheads due to indirect references, it would require > more implementation costs. Which method we choose, I think we need > performance measurements in several scenarios to check if performance > regressions don't happen unexpectedly. OK. So the next step is collecting more opinions, right? Could you add key people in this area to Cc to hear their opinions? I'm not familiar with key people in the PostgreSQL community... Thanks, -- kou