Re: Proposal: PqSendBuffer removal - Mailing list pgsql-hackers

From Aleksei Ivanov
Subject Re: Proposal: PqSendBuffer removal
Date
Msg-id CAN0E21Nt7SFqrbO55Jd_PGQ2AakQF_h8EbUmVP-5SfzrMrG9TA@mail.gmail.com
Whole thread Raw
In response to Re: Proposal: PqSendBuffer removal  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Proposal: PqSendBuffer removal  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Proposal: PqSendBuffer removal  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Thank you for your reply!

Yes, you are right there will be a separate call to send the data, but is copying data each time more costly operation than just one syscall?

Besides, if we already have a ready message packet to be sent why should we wait?

Waiting for your reply, 
Best regards!



On Thu, Mar 5, 2020 at 13:10 Tom Lane <tgl@sss.pgh.pa.us> wrote:
Aleksei Ivanov <iv.alekseii@gmail.com> writes:
> I am really curious what was the original intention of using the
> PqSendBuffer and is it possible to remove it now.

> Currently all messages are copied from StringInfo to this buffer and sent,
> which from my point of view is redundant operation.

That would mean doing a separate send() kernel call for every few bytes,
no?  I think the point of that buffer is to be sure we accumulate a
reasonable number of bytes to pass to the kernel for each send().

                        regards, tom lane

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Allowing ALTER TYPE to change storage strategy
Next
From: Kartyshov Ivan
Date:
Subject: Re: [HACKERS] make async slave to wait for lsn to be replayed