From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | Masahiko Sawada <msawada(at)postgresql(dot)org>, pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | Re: pgsql: Refactor COPY FROM to use format callback functions. |
Date: | 2025-02-28 20:56:19 |
Message-ID: | CAD21AoBA414Q76LthY65NJfWbjOxXn1bdFFsD_NBhT2wPUS1SQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
On Fri, Feb 28, 2025 at 12:14 PM Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
>
> On 2025-02-28 Fr 2:55 PM, Masahiko Sawada wrote:
> > On Fri, Feb 28, 2025 at 11:47 AM Andrew Dunstan <andrew(at)dunslane(dot)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(at)clear-code(dot)com>
> >> Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
> >> Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
> >> Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
> >> Reviewed-by: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
> >> Reviewed-by: Junwang Zhao <zhjwpku(at)gmail(dot)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.
Right. I've attached the updated patch.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
Attachment | Content-Type | Size |
---|---|---|
0001-Re-export-NextCopyFromRawFields-to-copy.h.patch | application/octet-stream | 3.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2025-02-28 22:06:19 | pgsql: Adjust auto_explain's GUC descriptions. |
Previous Message | Tom Lane | 2025-02-28 20:20:44 | pgsql: Tweak regex to avoid a bug in Perl 5.16.3. |