Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XkbIe-0008Dy-ST for pgsql-hackers@arkaria.postgresql.org; Sat, 01 Nov 2014 16:13:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XkbIe-0003MF-8R for pgsql-hackers@arkaria.postgresql.org; Sat, 01 Nov 2014 16:13:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XkbId-0003M3-78; Sat, 01 Nov 2014 16:13:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XkbIa-0000JL-18; Sat, 01 Nov 2014 16:13:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id sA1GD3ZA004864; Sat, 1 Nov 2014 12:13:03 -0400 From: Tom Lane To: Mikko Tiihonen cc: "pgsql-hackers@postgresql.org" , "pgsql-jdbc@postgresql.org" Subject: Re: Pipelining executions to postgresql server In-reply-to: <1414850643686.34687@nitorcreations.com> References: <1414850643686.34687@nitorcreations.com> Comments: In-reply-to Mikko Tiihonen message dated "Sat, 01 Nov 2014 14:04:05 -0000" Date: Sat, 01 Nov 2014 12:13:03 -0400 Message-ID: <4863.1414858383@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Mikko Tiihonen writes: > I created a proof of concecpt patch for postgresql JDBC driver that allows the caller to do pipelining of requests within a transaction. The pipelining here means same as for HTTP: the client can send the next execution already before waiting for the response of the previous request to be fully processed. In principle this can work if you think through the error handling carefully. The way the FE/BE protocol is intended to handle the case is that all the pipelined statements are part of one transaction so that they all succeed or fail together. Otherwise the user has to work through and predict the outcome of all the combinations of "Q1 succeeded, Q2 failed, Q3 succeeded" which is mighty error-prone, especially if the commands are interdependent in any way at all. Having legislated that (and forbidden any transaction-boundary commands in a pipelined group), what you do is not issue a Sync until after the last command of the set. Then, if any command fails, the backend just automatically discards remaining messages until it gets the Sync, and so you can safely issue new commands before knowing the results of the previous ones. I mention this because, although I don't know the innards of the JDBC driver at all, it sure doesn't look like that's the way you've done it. If I'm right that you've left the error recovery strategy to the user, I think this is gonna be very hard to use safely. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers