Re: [HACKERS] Pipelining executions to postgresql server

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Mikko Tiihonen <Mikko(dot)Tiihonen(at)nitorcreations(dot)com>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, "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 01:56:17
Message-ID: 54583241.8030506@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On 11/04/2014 09:10 AM, Tom Lane wrote:
> Mikko Tiihonen <Mikko(dot)Tiihonen(at)nitorcreations(dot)com> writes:
>> I do not quite grasp why not sending Sync is so important. My proof of concept setup was for queries with autocommit enabled.
>
> [snip] It'll be very much like
> sending a fixed (predetermined) SQL script to the server using a scripting
> language that lacks any conditionals.

... which is part of why I think the batch interface for JDBC is the
appropriate UI, and the existing support in PgJDBC just needs to be
extended to support returning result sets.

The JDBC driver supports multiple result sets, and a batch execution
looks just like a procedure that returned multiple result sets (or
rather, a mix of result sets, affected rowcounts, and no-info success
messages).

See

http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#addBatch(java.lang.String)

http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#executeBatch()

The docs are admittedly mostly oriented toward DML, but nothing stops us
returning SUCCESS_NO_INFO and a resultset. Or if we choose, returning a
rowcount and resultset.

It'd be worth testing what other drivers do before doing that, but
nothing in the spec:

https://jcp.org/aboutJava/communityprocess/mrel/jsr221/index.html

seems to stop us doing it.

The batch interface doesn't offer any way to set scrollable/editable
resultset options, but we don't want to allow that for batches anyway.

--
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 Michael Paquier 2014-11-04 02:27:34 Re: [PG-XC] how to pass a value(String) from coordinator node to all data nodes
Previous Message David Fetter 2014-11-04 01:52:41 Re: Let's drop two obsolete features which are bear-traps for novices

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2014-11-04 07:21:51 Re: [JDBC] Pipelining executions to postgresql server
Previous Message Tom Lane 2014-11-04 01:10:05 Re: Pipelining executions to postgresql server