diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-07-25 16:34:35 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-07-25 16:34:35 -0400 |
commit | 0a0727ccfc5f4e2926623abe877bdc0b5bfd682e (patch) | |
tree | c2efe923fd542ebe195f1f51d685d9aa8f4a8a60 /src/backend/utils/adt/pgstatfuncs.c | |
parent | 8a37951eebffd9bf528cb06d46127fb721d0e452 (diff) | |
download | postgresql-0a0727ccfc5f4e2926623abe877bdc0b5bfd682e.tar.gz postgresql-0a0727ccfc5f4e2926623abe877bdc0b5bfd682e.zip |
Improve performance of binary COPY FROM through better buffering.
At least on Linux and macOS, fread() turns out to have far higher
per-call overhead than one could wish. Reading 64KB of data at a time
and then parceling it out with our own memcpy logic makes binary COPY
from a file significantly faster --- around 30% in simple testing for
cases with narrow text columns (on Linux ... even more on macOS).
In binary COPY from frontend, there's no per-call fread(), and this
patch introduces an extra layer of memcpy'ing, but it still manages
to eke out a small win. Apparently, the control-logic overhead in
CopyGetData() is enough to be worth avoiding for small fetches.
Bharath Rupireddy and Amit Langote, reviewed by Vignesh C,
cosmetic tweaks by me
Discussion: https://postgr.es/m/CALj2ACU5Bz06HWLwqSzNMN=Gupoj6Rcn_QVC+k070V4em9wu=A@mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/pgstatfuncs.c')
0 files changed, 0 insertions, 0 deletions