From: Andrew Dunstan <andrew@dunslane.net>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Masahiko Sawada <msawada@postgresql.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Refactor COPY FROM to use format callback functions.
Date: Fri, 28 Feb 2025 15:14:07 -0500
Message-ID: <d3b11749-7d0d-40c6-b2be-0e45958881da@dunslane.net> (raw)
In-Reply-To: <CAD21AoDrDQy-cBHaghYkFb=_iPhgJg0H-hscrRtBf3r+xaVe-Q@mail.gmail.com>
References: <E1to58i-000AeZ-03@gemulon.postgresql.org>
<5c7e1ac8-5083-4c08-af19-cb9ade2f16ce@dunslane.net>
<CAD21AoDrDQy-cBHaghYkFb=_iPhgJg0H-hscrRtBf3r+xaVe-Q@mail.gmail.com>
On 2025-02-28 Fr 2:55 PM, Masahiko Sawada wrote:
> On Fri, Feb 28, 2025 at 11:47 AM Andrew Dunstan <andrew@dunslane.net> wrote:
>>
>> On 2025-02-28 Fr 1:31 PM, Masahiko Sawada wrote:
>>
>> Refactor COPY FROM to use format callback functions.
>>
>> This commit introduces a new CopyFromRoutine struct, which is a set of
>> callback routines to read tuples in a specific format. It also makes
>> COPY FROM with the existing formats (text, CSV, and binary) utilize
>> these format callbacks.
>>
>> This change is a preliminary step towards making the COPY FROM command
>> extensible in terms of input formats.
>>
>> Similar to 2e4127b6d2d, this refactoring contributes to a performance
>> improvement by reducing the number of "if" branches that need to be
>> checked on a per-row basis when sending field representations in text
>> or CSV mode. The performance benchmark results showed ~5% performance
>> gain in text or CSV mode.
>>
>> Author: Sutou Kouhei <kou@clear-code.com>
>> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
>> Reviewed-by: Michael Paquier <michael@paquier.xyz>
>> Reviewed-by: Andres Freund <andres@anarazel.de>
>> Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com>
>> Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>
>> Discussion: https://postgr.es/m/20231204.153548.2126325458835528809.kou@clear-code.com
>>
>>
>>
>> This patch has completely broken the file_textarray fdw, which uses NextCopyFromRawFields(). Removing that from API is not a good thing.
>>
> Thank you for pointing it out.
>
> I've just posted my analysis[1] and am planning to revive that API
> (Sutou-san already proposed an idea). Could you please check if the
> idea would work for file_text_array_fdw?
>
Looks OK, I think. You could even use the Internal function further down
in the file and avoid a function call.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: andrew@dunslane.net, sawada.mshk@gmail.com, msawada@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Refactor COPY FROM to use format callback functions.
In-Reply-To: <d3b11749-7d0d-40c6-b2be-0e45958881da@dunslane.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox