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.96) (envelope-from ) id 1vsvFU-008kxV-22 for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Feb 2026 04:02:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vsvFT-001eJr-1L for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Feb 2026 04:02:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vsvFT-001eJh-0J for pgsql-hackers@lists.postgresql.org; Thu, 19 Feb 2026 04:02:43 +0000 Received: from mail-dl1-x1232.google.com ([2607:f8b0:4864:20::1232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vsvFO-0000000053a-41n5 for pgsql-hackers@postgresql.org; Thu, 19 Feb 2026 04:02:41 +0000 Received: by mail-dl1-x1232.google.com with SMTP id a92af1059eb24-12713e56abdso457675c88.1 for ; Wed, 18 Feb 2026 20:02:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771473757; cv=none; d=google.com; s=arc-20240605; b=DSOxknigfiEuoaL67qm4VQl9oK6DzWKBO/PF0ietIdJeJ8L4sfUrsa0ylcgStRUKw7 WDfslOZo5UhrbPKHdr4DrkqmXWMACrabZgRbAcPNOZJUqv0NGFOYE+2l4j5zQkf+hO2H EImlyvCdEegKXE0xvM1bnzAXBxbSoh9ymDw6pljK37qw7y5bxEzMpwPKq0DA04SsxR5r cZAKiHAumTJTuSzgsu7cgL62hN7iRrdriyDc0PNKhshs042h/CScmYtYW2947PGRxbtM 517jq9u46IN09Tv5xSLHymAoIb5tuUb9/VcBZJ2IV/bgfFZB4gNL99kllgCbK8Njfeq8 dxwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=WEKFLMyy0cd5xNW+U/zP/g0PbAdN9mZrF2w4WMKVYzA=; fh=2yro2bUyy3lnsxVaI4vaZlCHPPJSWErD248vgi8hl6c=; b=iUeuTBx65RR8fw4LnIf5kUfW++ATh881QzMvMUS54GMP/2s9rwfnQuegN9SvPePaNx pBVpWWkHexFNIeDj0zoKfCy73B7cek900khXFgn9bzWmU5i6HDYWu8u7hxcvLTT0VWr6 0ohUxfH4KGGaHGA3Yk+zbxUxrjI+IhNKGJCRbgrRJs5IATgWsCAG3w9aEii87AZXR1p8 fu9k7FCa9Cr+Ah/12LI+b9W/6b2WXFwZzN5i4IvMZzBZPYn5xCXKK8+F7SBW/IpFbkkW lFQ5K4LTKxuRb7uLpIiJBLPcZZ6jyWFm4gvPFW3YkXhK4WOOU0WMoeyVXD1HJX2C2HcB +9+g==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1771473757; x=1772078557; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=WEKFLMyy0cd5xNW+U/zP/g0PbAdN9mZrF2w4WMKVYzA=; b=l29/eRERqJ0+Pok9TYbGMM4lUOa8ZwiLUOmylLNXCNkqE0XPke70JEBmhdDjCsNa8f bUzElwGFWKyUAbgez2E7DZuFi9JgVchQMIRJe5HrF/FNUzenOF6TfOgFWwtvraM2FEuP BowH4+uos02rL08z5hphm6wndpspgRDb3ouQ2DGfzAupFK2FCtT91AXkx+owJba4mj86 aO4p3NJaYjkxSj+D3tTvKIADSVi2nKWRxt4tWrLaAcFnFi+6kopfQuYp7yU7NWaaH4Ee nk3vsgnenXT0qteXHlE7Ujn+z84+lsxcaQz33AbVmgLx+w3mk96RBwE/YdzgzKyi2yGa LJ5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771473757; x=1772078557; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WEKFLMyy0cd5xNW+U/zP/g0PbAdN9mZrF2w4WMKVYzA=; b=XOLzgYUoaNTT1f9kAUo1mmTYOZ4X7fEOGHUYIal5gNh56GznnavS+68Wi6qaQTYF5C aPDY5n6gBHwUtIfyTNjkCetYwa48Cq9ScdYHL6PZnCbEycM8i6mO/prKHI9cu8mZlt7B hj8ZIqwHSMF/aNU5DVWblAi5Xo6zVJHgfEpKludoeG1GcVa8yXZ3YRhg44Z4qAjZJy+3 EZIVKL0WbBosfrjjIatw1jI76iVHdykwH45Vg5tDn4BhrSIz74hEZ1VFP5WUyskHlI+a fvHF9GujCnvPq1KR6Eb7H8R/Dhj/DCisEumpw3pA2DTyyiWjRhwHU1WbVeZeu/XdFi9m j27w== X-Forwarded-Encrypted: i=1; AJvYcCU6qWoi4seHjamKvyr880ZKt2vnp9OBt7KI+qTONOAS5AgoFKmA9TMCDzqoPBcNoNqhN6X+RhSSTqUaRii1@postgresql.org X-Gm-Message-State: AOJu0YzKPm+TdWH/rhJYRX61wt1/7XkdNobniYuounr9wfD9k5BCb4Xf e3MSbn0VlVLXPOfzMwTSUvgx2PPjt0a3x29wVL+zA7d/jdwu8diqJTfrC8jLm9mNiHE6uMGV4KG 1EosZ6uP3t8A72odx+zMZegtOd1Zb/81vr7mCLts0 X-Gm-Gg: AZuq6aL35/d5yD/zGjjfwQAiv6pi+c/af3GGaAO7hohDqvw37b5SYiC5jHs1IpFxPrA NOiJS45qelpBbRdyMYzwX7HRO3u+nxCFjVlOhE//DUw8eiSHdI/4cXt8vbHYSck4Q1b0KaC93W6 q+O0b4cSpsK9suCrAvoz9eRr65BJvMqeMF8Q4Qk0uLYOS1KxafAdwE9ir/dHQ+aqYmhqFqptByg S3z4BWPGnbSRnnEgV3FhF55rEH3EIzR5EB+kgOx8Jb65Z0Y8jVbmgbrJkcxj+C7KuawWVaXe7bK bbpHi3+OyWrMKmhLA31F X-Received: by 2002:a05:7022:60a2:b0:11d:fd41:62c8 with SMTP id a92af1059eb24-1275fa6c007mr209506c88.13.1771473756785; Wed, 18 Feb 2026 20:02:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Manni Wood Date: Wed, 18 Feb 2026 22:02:25 -0600 X-Gm-Features: AaiRm514URv0bQ5CICtS1D21YhVw8VYMoWjaBwv45_vVJtUA6J-XUhTMM_rR8UU Message-ID: Subject: Re: Speed up COPY FROM text/CSV parsing using SIMD To: Nazir Bilal Yavuz Cc: Nathan Bossart , KAZAR Ayoub , Neil Conway , Andrew Dunstan , Shinya Kato , PostgreSQL-development Content-Type: multipart/alternative; boundary="00000000000000a168064b2560d8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000000a168064b2560d8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 18, 2026 at 3:54=E2=80=AFPM Nazir Bilal Yavuz wrote: > Hi, > > On Thu, 19 Feb 2026 at 00:26, Nathan Bossart > wrote: > > > > On Wed, Feb 18, 2026 at 04:38:07PM +0300, Nazir Bilal Yavuz wrote: > > > By looking at these results having both is_csv and simd_enabled as an > > > argument and sending them as constant boolean arguments help most. > > > > Thanks for doing these tests. ISTM we might as well get this initial > > inlining stuff committed. Thoughts? > > nitpick: > > -static bool CopyReadLineText(CopyFromState cstate, bool is_csv); > +static pg_attribute_always_inline bool CopyReadLineText(CopyFromState > cstate, > + bool is_csv); > > Do we want to move the new CopyReadLineText() declaration below to > group it with the other functions marked pg_attribute_always_inline? > > Other than that, LGTM. I think it makes sense to separately commit this. > > -- > Regards, > Nazir Bilal Yavuz > Microsoft > Hello. I took some time tonight to apply v8 to the latest master (759b03b2) on my x86 tower and arm raspberry pi 5. Here are the results, using both narrow columns and the wider columns we've been using througout: x86 master NARROW TXT : 2587.642000 ms CSV : 2621.759000 ms TXT with 1/3 escapes: 2707.933500 ms CSV with 1/3 quotes: 3254.896500 ms x86 v8 NARROW TXT : 2488.655250 ms 3.825365% improvement CSV : 2628.818000 ms -0.269247% regression TXT with 1/3 escapes: 2615.522000 ms 3.412621% improvement CSV with 1/3 quotes: 3446.368000 ms -5.882568% regression x86 master WIDE TXT : 30583.229500 ms CSV : 35054.533500 ms TXT with 1/3 escapes: 32767.421500 ms CSV with 1/3 quotes: 44214.163500 ms x86 v8 WIDE TXT : 26527.494250 ms 13.261305% improvement CSV : 33364.443750 ms 4.821316% improvement TXT with 1/3 escapes: 29320.648000 ms 10.518904% improvement CSV with 1/3 quotes: 42334.074750 ms 4.252232% improvement arm master NARROW TXT : 1999.401000 ms CSV : 2081.610750 ms TXT with 1/3 escapes: 2053.230250 ms CSV with 1/3 quotes: 2431.608750 ms arm v8 NARROW TXT : 1981.663750 ms 0.887128% improvement CSV : 2023.892500 ms 2.772769% improvement TXT with 1/3 escapes: 2004.215250 ms 2.387214% improvement CSV with 1/3 quotes: 2616.872750 ms -7.618989% regression arm master WIDE TXT : 9120.731750 ms CSV : 11114.478250 ms TXT with 1/3 escapes: 10338.124500 ms CSV with 1/3 quotes: 13404.430250 ms arm v8 WIDE TXT : 8430.090750 ms 7.572210% improvement CSV : 10115.135500 ms 8.991360% improvement TXT with 1/3 escapes: 9624.383500 ms 6.903970% improvement CSV with 1/3 quotes: 12331.714000 ms 8.002699% improvement --=20 -- Manni Wood EDB: https://www.enterprisedb.com --00000000000000a168064b2560d8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Wed, Feb 18,= 2026 at 3:54=E2=80=AFPM Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
Hi,

On Thu, 19 Feb 2026 at 00:26, Nathan Bossart <nathandbossart@gmail.com> wrote:=
>
> On Wed, Feb 18, 2026 at 04:38:07PM +0300, Nazir Bilal Yavuz wrote:
> > By looking at these results having both is_csv and simd_enabled a= s an
> > argument and sending them as constant boolean arguments help most= .
>
> Thanks for doing these tests.=C2=A0 ISTM we might as well get this ini= tial
> inlining stuff committed.=C2=A0 Thoughts?

nitpick:

-static bool CopyReadLineText(CopyFromState cstate, bool is_csv);
+static pg_attribute_always_inline bool CopyReadLineText(CopyFromState csta= te,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bool is_csv);

Do we want to move the new CopyReadLineText() declaration below to
group it with the other functions marked pg_attribute_always_inline?

Other than that, LGTM. I think it makes sense to separately commit this.
--
Regards,
Nazir Bilal Yavuz
Microsoft

Hello.

<= /div>
I took some time tonight to apply v8 to the latest master (759b03= b2) on my x86 tower and arm raspberry pi 5.

Here a= re the results, using both narrow columns and the wider columns we've b= een using througout:

x86 master NARROW
TXT : = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 2587.642000 ms
C= SV : =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 2621.759000 ms=
TXT with 1/3 escapes: 2707.933500 ms
CSV with 1/3 quotes: =C2=A03254= .896500 ms

x86 v8 NARROW
TXT : =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 2488.655250 ms =C2=A03.825365% improvement
CSV : = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 2628.818000 ms =C2= =A0-0.269247% regression
TXT with 1/3 escapes: 2615.522000 ms =C2=A03.41= 2621% improvement
CSV with 1/3 quotes: =C2=A03446.368000 ms =C2=A0-5.882= 568% regression

x86 master WIDE
TXT : =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 30583.229500 ms
CSV : =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 35054.533500 ms
TXT with 1/3 escapes:= 32767.421500 ms
CSV with 1/3 quotes: =C2=A044214.163500 ms

x86 v= 8 WIDE
TXT : =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 265= 27.494250 ms =C2=A013.261305% improvement
CSV : =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 33364.443750 ms =C2=A04.821316% improvement=
TXT with 1/3 escapes: 29320.648000 ms =C2=A010.518904% improvement
C= SV with 1/3 quotes: =C2=A042334.074750 ms =C2=A04.252232% improvement


arm master NARROW
TXT : =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 1999.401000 ms
CSV : =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 2081.610750 ms
TXT with 1/3 escapes: 2053.23025= 0 ms
CSV with 1/3 quotes: =C2=A02431.608750 ms

arm v8 NARROW
T= XT : =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1981.663750 ms= =C2=A00.887128% improvement
CSV : =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 2023.892500 ms =C2=A02.772769% improvement
TXT with= 1/3 escapes: 2004.215250 ms =C2=A02.387214% improvement
CSV with 1/3 qu= otes: =C2=A02616.872750 ms =C2=A0-7.618989% regression

arm master WI= DE
TXT : =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 9120.73= 1750 ms
CSV : =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 11= 114.478250 ms
TXT with 1/3 escapes: 10338.124500 ms
CSV with 1/3 quot= es: =C2=A013404.430250 ms

arm v8 WIDE
TXT : =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8430.090750 ms =C2=A07.572210% improveme= nt
CSV : =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 10115.1= 35500 ms =C2=A08.991360% improvement
TXT with 1/3 escapes: 9624.383500 m= s =C2=A06.903970% improvement
CSV with 1/3 quotes: =C2=A012331.714000 ms= =C2=A08.002699% improvement


--
-- Manni Wood EDB: https://www.enterprisedb.com
--00000000000000a168064b2560d8--