I would set the SO_SNDBUF to 32768.
> Hi,
>
> I see a performance issue on win32. This problem is causes by the
> following URL.
>
> http://support.microsoft.com/kb/823764/EN-US/
>
> On win32, default SO_SNDBUF value is 8192 bytes. And libpq's buffer is
> 8192 too.
>
> pqcomm.c:117
> #define PQ_BUFFER_SIZE 8192
>
> send() may take as long as 200ms. So, I think we should increase
> SO_SNDBUF to more than 8192. I attache the patch.
>
> Regards,
> --
> Yoshiyuki Asaba
> y-asaba(at)sraoss(dot)co(dot)jp
> Index: pqcomm.c
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/backend/libpq/pqcomm.c,v
> retrieving revision 1.184
> diff -c -r1.184 pqcomm.c
> *** pqcomm.c 5 Mar 2006 15:58:27 -0000 1.184
> --- pqcomm.c 27 Jun 2006 15:17:18 -0000
> ***************
> *** 593,598 ****
> --- 593,608 ----
> return STATUS_ERROR;
> }
>
> + #ifdef WIN32
> + on = PQ_BUFFER_SIZE * 2;
> + if (setsockopt(port->sock, SOL_SOCKET, SO_SNDBUF,
> + (char *) &on, sizeof(on)) < 0)
> + {
> + elog(LOG, "setsockopt(SO_SNDBUF) failed: %m");
> + return STATUS_ERROR;
> + }
> + #endif
> +
> /*
> * Also apply the current keepalive parameters. If we fail to set a
> * parameter, don't error out, because these aren't universally
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>