On 31.10.2011 17:44, Mark Hills wrote:
> We have a user interface which fetches and displays many small pieces of
> distinct information from a PostgreSQL database.
> * fetches are simple lookups across a diverse set of tables,
> in response to events on another data source
> * uses PQsendQuery() on a non-blocking socket
> But data fetches visibly take some time -- libpq doesn't allow a second
> query to be sent until the first has been fully processed. The
> back-and-forth seems to give a bottleneck on the round-trip.
> Instead, it would be preferable to send multiple requests (down the TCP
> socket), and then receive multiple responses (in order).
> This would allow the sending, processing and receiving response to be
> interleaved much more reasonably, and reduce the delay.
> Could libpq be reasonably modified to allow this?
I believe it's doable in theory, no-one has just gotten around to it.
Patches are welcome.
> Also, whilst tracing code through to pqsecure_write(), I also wondered if
> some Nagle's algorithm on the socket is also introducing an additional
> delay? I can't see special consideration in the code for this (eg.
We do set TCP_NODELAY, see connectNoDelay() in fe-connect.c
In response to
pgsql-hackers by date
|Next:||From: Marti Raudsepp||Date: 2011-10-31 16:57:58|
|Subject: Re: Multiple queries in transit|
|Previous:||From: Mark Hills||Date: 2011-10-31 15:44:02|
|Subject: Multiple queries in transit|