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

From: Filip Janus <fjanus(at)redhat(dot)com>
To: Philipp Marek <philipp(at)marek(dot)priv(dot)at>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Better Performance for PostgreSQL with large INSERTs
Date: 2025-10-06 09:58:59
Message-ID: CAFjYY+KAkCRVpxyghe+1STnH-AOMH+0Nje5jDfeKa8L9WzU-EA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
7% is an interesting improvement for these cases. I see it as a nice
feature,
What about adding a GUC variable to have the ability to configure
PQ_RECV_BUFFER_SIZE based on the user's needs?

-Filip-

út 30. 9. 2025 v 10:42 odesílatel Philipp Marek <philipp(at)marek(dot)priv(dot)at>
napsal:

> Here's the patch again, this time with a 128kB buffer size.
>
> This gives us nearly the same gains (~7%) for the blob INSERTs,
> and the additional memory usage (120kB) shouldn't really matter,
> with "temp_buffer"s 8MB and "work_mem" 4MB defaults.
>
> Making it configurable would give a much more complex patch --
> so I suggest just using this fixed size.
>
>
> Thanks!
>
>
> diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
> index 25f739a6..72d092b2 100644
> --- a/src/backend/libpq/pqcomm.c
> +++ b/src/backend/libpq/pqcomm.c
> @@ -117,7 +117,7 @@ static List *sock_paths = NIL;
> */
>
> #define PQ_SEND_BUFFER_SIZE 8192
> -#define PQ_RECV_BUFFER_SIZE 8192
> +#define PQ_RECV_BUFFER_SIZE (128 * 1024)
>
> static char *PqSendBuffer;
> static int PqSendBufferSize; /* Size send buffer */
>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2025-10-06 10:44:10 Re: split func.sgml to separated individual sgml files
Previous Message jian he 2025-10-06 09:48:53 Re: speedup COPY TO for partitioned table.