pgsql: Avoid useless buffer allocations during binary COPY FROM.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid useless buffer allocations during binary COPY FROM.
Date: 2020-07-11 18:21:36
Message-ID: E1juK80-0007fc-Or@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid useless buffer allocations during binary COPY FROM.

The raw_buf and line_buf buffers aren't used when reading binary format,
so skip allocating them. raw_buf is 64K so that seems like a worthwhile
savings. An unused line_buf only wastes 1K, but as long as we're checking
it's free to avoid allocating that too.

Bharath Rupireddy, tweaked a bit by me

Discussion: https://postgr.es/m/CALj2ACXcCKaGPY0whowqrJ4OPJvDnTssgpGCzvuFQu5z0CXb-g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/cd22d3cdb9bd9963c694c01a8c0232bbae3ddcfb

Modified Files
--------------
src/backend/commands/copy.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2020-07-12 11:47:38 pgsql: Include replication origins in SQL functions for commit timestam
Previous Message Tom Lane 2020-07-11 17:37:21 pgsql: Avoid trying to restore table ACLs and per-column ACLs in parall