Re: [PATCH] Better Performance for PostgreSQL with large INSERTs

From: Philipp Marek <philipp(at)marek(dot)priv(dot)at>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Better Performance for PostgreSQL with large INSERTs
Date: 2025-10-07 13:03:29
Message-ID: 8abc4b15a3f2dba983daf424dee91fbb@marek.priv.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Andres,

> Have you tried to verify that this doesn't cause performance
> regressions in
> other workloads? pq_recvbuf() has this code:
>
...
>
> I do seem to recall that just increasing the buffer size substantially
> lead to
> more time being spent inside that memmove() (likely due to exceeding
> L1/L2).

Do you have any pointers to discussions or other data about that?

My (quick) analysis was that clients that send one request,
wait for an answer, then send the next request wouldn't run that code
as there's nothing behind the individual requests that could be moved.

But yes, Pipeline Mode[1] might/would be affected.

The interesting question is how much data can userspace copy before
that means more load than doing a userspace-kernel-userspace round trip.
(I guess that moving 64kB or 128kB should be quicker, especially since
the various CPU mitigations.)

As long as there are complete requests in the buffer the memmove()
could be avoided; only the initial part of the first incomplete request
might need moving to the beginning.

That patch would be more than +- 1 line again ;)

The documentation says

> Pipelining is less useful, and more complex,
> when a single pipeline contains multiple transactions
> (see Section 32.5.1.3).

are there any benchmarks/usage statistics for pipeline mode?

Regards,

Phil

Ad 1: https://www.postgresql.org/docs/current/libpq-pipeline-mode.html

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Devrim Gündüz 2025-10-07 13:10:51 Re: git head build failure
Previous Message Philipp Marek 2025-10-07 12:50:23 Re: [PATCH] Better Performance for PostgreSQL with large INSERTs