libpq: PQgetCopyData() and allocation overhead

Jeroen Vermeulen <jtvjtv@gmail.com>

From: Jeroen Vermeulen <jtvjtv@gmail.com>
To: pgsql-hackers@postgresql.org
Date: 2023-02-09T23:25:45Z
Lists: pgsql-hackers
Would there be interest in a variant of PQgetCopyData() that re-uses the
same buffer for a new row, rather than allocating a new buffer on each
iteration?

I tried it on a toy benchmark, and it reduced client-side CPU time by about
12%.  (Less of a difference in wall-clock time of course; the client was
only using the CPU for a bit over half the time.)


Jeroen