From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: psql \copy from sends a lot of packets |
Date: | 2021-02-06 22:23:33 |
Message-ID: | 334619.1612650213@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
> I just noticed that if you load a file using psql:
> it sends every line as a separate FE/BE protocol CopyData packet.
> ...
> I'll add this to the next commitfest. There's similar inefficiency in
> the server side in COPY TO, but I'll leave that for another patch.
The FE/BE protocol documentation is pretty explicit about this:
Copy-in mode (data transfer to the server) is initiated when the
backend executes a COPY FROM STDIN SQL statement. The backend sends a
CopyInResponse message to the frontend. The frontend should then send
zero or more CopyData messages, forming a stream of input data. (The
message boundaries are not required to have anything to do with row
boundaries, although that is often a reasonable choice.)
...
Copy-out mode (data transfer from the server) is initiated when the
backend executes a COPY TO STDOUT SQL statement. The backend sends a
CopyOutResponse message to the frontend, followed by zero or more
CopyData messages (always one per row), followed by CopyDone.
So while changing psql isn't so much a problem, changing the server
is a wire protocol break. Maybe we should do it anyway, but I'm
not sure.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Nancarrow | 2021-02-06 22:29:15 | Bug in query rewriter - hasModifyingCTE not getting set |
Previous Message | Heikki Linnakangas | 2021-02-06 22:13:38 | psql \copy from sends a lot of packets |