| From: | Ayoub Kazar <ayoub(dot)kazar(at)data-bene(dot)io> |
|---|---|
| To: | KAZAR Ayoub <ma_kazar(at)esi(dot)dz>, Nathan Bossart <nathandbossart(at)gmail(dot)com> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Neil Conway <neil(dot)conway(at)gmail(dot)com>, Manni Wood <manni(dot)wood(at)enterprisedb(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>, Mark Wong <markwkm(at)gmail(dot)com>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com> |
| Subject: | Re: Speed up COPY TO text/CSV parsing using SIMD |
| Date: | 2026-09-03 16:01:15 |
| Message-ID: | 777bc2f5-957e-4c8b-9f63-1d54e1f1bc3d@data-bene.io |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 02/04/2026 20:07, KAZAR Ayoub wrote:
> On Tue, Mar 31, 2026 at 6:30 PM Nathan Bossart
> <nathandbossart(at)gmail(dot)com> wrote:
>
> On Fri, Mar 27, 2026 at 07:48:38PM +0100, KAZAR Ayoub wrote:
> > I added a prescan loop inside the simd helpers trying to catch
> special
> > chars in sizeof(Vector8) characters, i measured how good is this at
> > reducing the overhead of starting simd and exiting at first vector:
> > the scalar loop is better than SIMD for one vector if it finds a
> special
> > character before 6th character, worst case is not a clean
> vector, where the
> > scalar loop needs 20 more cycles compared to SIMD.
> > This helps mitigate the case of JSON(B) in CSV format, this is
> why I only
> > added this for CSV case only.
>
> Interesting.
>
> > In a benchmark with 10M early SIMD exit like the JSONB case, the
> previous
> > 3% regression is gone.
>
> While these are nice results, I think it's best that we target v20
> for this
> patch so that we have more time to benchmark and explore edge cases.
>
> Thanks for the review.
> Fair enough, I'll try many more cases in the upcoming weeks to make
> sure we're not missing anything.
>
>
> --
> nathan
>
> Regards,
> Ayoub
After looking into more test cases, the opportunity here isn't as big as
it was for COPY FROM in general cases, yet i have seen good performance
gains show up in most cases, and avoiding regressions elsewhere adds
some complexity, there's also the possibility to include the case of
TOASTed attributes here ; which i think is a win.
I’ve marked the Commitfest entry as Withdrawn. Thanks to everyone for
the reviews and feedback.
If anyone else think we can still push this patch more forward, i'll
take a look again.
Regards,
Ayoub
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Geier | 2026-09-03 16:02:23 | Re: Reducing relcache memory usage: deduping index shapes |
| Previous Message | SATYANARAYANA NARLAPURAM | 2026-09-03 15:21:06 | Re: WAIT FOR NO_THROW option could use some documentation |