Re: libpq: PQgetCopyData() and allocation overhead - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: libpq: PQgetCopyData() and allocation overhead
Date
Msg-id CALj2ACXiC3Wy7o=81j8jpY=nQq3Hs4y+06gXDkOBrmoO+JDrrw@mail.gmail.com
Whole thread Raw
In response to libpq: PQgetCopyData() and allocation overhead  (Jeroen Vermeulen <jtvjtv@gmail.com>)
Responses Re: libpq: PQgetCopyData() and allocation overhead
List pgsql-hackers
On Fri, Feb 10, 2023 at 3:43 PM Jeroen Vermeulen <jtvjtv@gmail.com> wrote:
>
> Would there be interest in a variant of PQgetCopyData() that re-uses the same buffer for a new row, rather than
allocatinga 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
timeof course; the client was only using the CPU for a bit over half the time.)
 

Interesting. It might improve logical replication performance too as
it uses COPY protocol.

Do you mind sharing a patch, test case that you used and steps to
verify the benefit?

-- 
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Jelte Fennema
Date:
Subject: Re: run pgindent on a regular basis / scripted manner
Next
From: Jeroen Vermeulen
Date:
Subject: Re: libpq: PQgetCopyData() and allocation overhead