From: Craig Ringer <craig@2ndquadrant.com>
To: Vitalii Tymchyshyn <vit@tym.im>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: John R Pierce <pierce@hogranch.com>
Cc: PG-JDBC Mailing List <pgsql-jdbc@postgresql.org>
Subject: Re: Disk buffering of resultsets
Date: Thu, 09 Oct 2014 10:32:58 +0800
Message-ID: <5435F3DA.1060401@2ndquadrant.com> (raw)
In-Reply-To: <CABWW-d0bNau=Ypx2iidbmMeuA8ks75xn=dNv7n4m_XEHz8wJkg@mail.gmail.com>
References: <CAHKhnVUW9hu9ePD9zeVmvkeRjK8VaO9_jVDdqiNPf8=xBkaM1Q@mail.gmail.com>
<541E7FC3.3000201@2ndquadrant.com>
<3F6D0B4E-2FA9-42D0-8C2C-DC68E6D0D641@gmail.com>
<54205F94.9010102@hogranch.com>
<CAHKhnVX5qxNOCBFXwivt1Mwzdaru9hoG9wCviAKUj9Dcmnu=0w@mail.gmail.com>
<542091F0.10706@hogranch.com>
<1321.1411433175@sss.pgh.pa.us>
<CABWW-d3QW0ywPge0-mVZ1d1WhsGwB5cWy4wOo3CK-sPOdqEKiA@mail.gmail.com>
<54300AA6.3040309@2ndquadrant.com>
<CABWW-d0bNau=Ypx2iidbmMeuA8ks75xn=dNv7n4m_XEHz8wJkg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
On 10/05/2014 11:24 AM, Vitalii Tymchyshyn wrote:
> Hello, all
>
> I've made a draft implementation of setFetchSize in autocommit mode
> here: https://github.com/tivv/pgjdbc/tree/autocommit_fetchsize
> Tests look good.
> Note that it does not try to limit Execute size as I don't think I
> understand protocol fully.
I really recommend addressing that part, then.
The protocol is pretty well documented; it doesn't make sense
implementing a new and somewhat complex approach if a simpler one is
possible and might be cleaner.
> The only thing it does is that it does not
> read everything before returning to the caller. Instead it reads
> response rows in fetchSize batches. If another statement tries to use
> the same connection, full result is read immediatelly (this part is not
> tested yet).
I'm still not convinced that reading the result set when the next
statement is run is the right answer.
I'd really like to be able to have the driver return a Runnable or
Future that lets the application assign the reading of the rest of the
result set to a thread, so it can be completed _before_ the app needs to
run another query.
If the current query isn't fully fetched when the next one is run, I'd
prefer to just throw an exception indicating that the previous query
must be fetched. Let the application deal with it. I really don't like
muddling queries together like this.
(That also means exceptions get dispatched in the right place - the
fetch of the prior query).
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: craig@2ndquadrant.com, vit@tym.im, tgl@sss.pgh.pa.us, pierce@hogranch.com
Subject: Re: Disk buffering of resultsets
In-Reply-To: <5435F3DA.1060401@2ndquadrant.com>
References: <CAHKhnVUW9hu9ePD9zeVmvkeRjK8VaO9_jVDdqiNPf8=xBkaM1Q@mail.gmail.com> <541E7FC3.3000201@2ndquadrant.com> <3F6D0B4E-2FA9-42D0-8C2C-DC68E6D0D641@gmail.com> <54205F94.9010102@hogranch.com> <CAHKhnVX5qxNOCBFXwivt1Mwzdaru9hoG9wCviAKUj9Dcmnu=0w@mail.gmail.com> <542091F0.10706@hogranch.com> <1321.1411433175@sss.pgh.pa.us> <CABWW-d3QW0ywPge0-mVZ1d1WhsGwB5cWy4wOo3CK-sPOdqEKiA@mail.gmail.com> <54300AA6.3040309@2ndquadrant.com> <CABWW-d0bNau=Ypx2iidbmMeuA8ks75xn=dNv7n4m_XEHz8wJkg@mail.gmail.com> <5435F3DA.1060401@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox