Pipelining executions to postgresql server - Mailing list pgsql-jdbc

From Mikko Tiihonen
Subject Pipelining executions to postgresql server
Date
Msg-id 1414850643686.34687@nitorcreations.com
Whole thread Raw
Responses Re: [HACKERS] Pipelining executions to postgresql server  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] Pipelining executions to postgresql server  (Andres Freund <andres@2ndquadrant.com>)
Re: [HACKERS] Pipelining executions to postgresql server  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-jdbc
Hi,

I created a proof of concecpt patch for postgresql JDBC driver that allows the caller to do pipelining of requests
withina transaction. The pipelining here means same as for HTTP: the client can send the next execution already before
waitingfor the response of the previous request to be fully processed. 

The goal is to reduce the effects of latency between server and client. The pipelining allowed my test with localhost
postgresqland jdbc test that queries a single value from database 200 times to get a more than 20% speed-up.
The pipeliningversion processes the responses every 10 queries. With actual latency between the server and client
largerspeed-ups are of course possible. 

I think pipelining + jsonb support would make postgresql even more competive key/value and document store.

Example use case:
1) insert to shopping cart table, and 3 inserts shopping cart rows table in one pipeline.
  - only one round trip penalty instead of 4
2) query shopping cart row and query shopping cart rows in one pipeline
  - only one round trip penalty instead of 2

The only alternative way to reduce the round-trip latency is to make every operation in single round-trip and that can
onlybe done with pl functions and by passing in more complex objects, for example the whole shopping cart with rows as
jsondata. 

What kind of problems could pipelining cause (assuming we limit it to rather simple use cases only)?

-Mikko
Attachment

pgsql-jdbc by date:

Previous
From: Mikko Tiihonen
Date:
Subject: Pull request for better handling of master/slave and load balancing when connecting to multiple hosts
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Pipelining executions to postgresql server