pgsql: In psql \copy from, send data to server in larger chunks.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: In psql \copy from, send data to server in larger chunks.
Date: 2021-07-14 10:10:25
Message-ID: E1m3bqT-0003Qc-JW@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

In psql \copy from, send data to server in larger chunks.

Previously, we would send each line as a separate CopyData message.
That's pretty wasteful if the table is narrow, as each CopyData message
has 5 bytes of overhead. For efficiency, buffer up and pack 8 kB of
input data into each CopyData message.

The server also sends each line as a separate CopyData message in COPY TO
STDOUT, and that's similarly wasteful. But that's documented in the FE/BE
protocol description, so changing that would be a wire protocol break.

Reviewed-by: Aleksander Alekseev
Discussion: https://www.postgresql.org/message-id/40b2cec0-d0fb-3191-2ae1-9a3fe16a7e48%40iki.fi

Branch
------
master

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

Modified Files
--------------
src/bin/psql/copy.c | 99 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 56 insertions(+), 43 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2021-07-14 12:44:30 Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.
Previous Message Magnus Hagander 2021-07-14 09:11:34 pgsql: Clarify description of pg_stat_statements columns