Re: [HACKERS] Pipelining executions to postgresql server

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Mikko Tiihonen <Mikko(dot)Tiihonen(at)nitorcreations(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [HACKERS] Pipelining executions to postgresql server
Date: 2014-11-04 07:28:46
Message-ID: 5458802E.5010706@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On 11/04/2014 07:56 AM, Mikko Tiihonen wrote:
> I do not quite grasp why not sending Sync is so important.

Well, at the moment the PgJDBC driver relies on the following flow to
manage its buffers and avoid a logjam where both server and client are
waiting for the other to consume input:

* Send some stuff
* Sync
* Consume input until Sync response received

... since at this point it knows the server's send buffer should be
empty, or near enough.

There's no fundamental reason why you *can't* send a Sync after each
query, AFAIK. You just have to change how the driver handles syncs so it
knows that there might be more work pipelined. Or fix the driver's
buffer management, as described in the github issues I linked.

It doesn't make much sense to unless you're running in autocommit mode
though, and I'm not convinced piplelining work in autocommit mode makes
a lot of sense. The biggest problem is exception handling - you can't
throw an exception at some statement execution in the past. So you need
a new interface for piplelining... or to just use the existing batch
interface.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2014-11-04 07:35:32 Re: [JDBC] Pipelining executions to postgresql server
Previous Message Craig Ringer 2014-11-04 07:21:51 Re: [JDBC] Pipelining executions to postgresql server

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2014-11-04 07:35:32 Re: [JDBC] Pipelining executions to postgresql server
Previous Message Craig Ringer 2014-11-04 07:21:51 Re: [JDBC] Pipelining executions to postgresql server