Skip site navigation (1) Skip section navigation (2)

Re: setFetchSize

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: fschmidt <fschmidt(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: setFetchSize
Date: 2011-10-26 22:56:17
Message-ID: CA+0W9LOYauE-hoa8C7H7HM0Gcb2wSi7N0aSfr2t8rkwg9yiGqw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
On 27 October 2011 09:22, fschmidt <fschmidt(at)gmail(dot)com> wrote:
>
> Dave Cramer-8 wrote:
>>
>> My understanding is this: Postgresql is an MVCC database and can
>> easily provide you with a snapshot of a resultset inside a
>> transaction. Outside a transaction my bet is that the data has to be
>> copied to a temporary location somewhere, so if this is done over N
>> connections the resources required could be substantial.
>>
> The solution is very simple.  Just keep the version associated with the
> current resultset around until the resultset is closed.  This is basically
> the same as having another connection, but in this case, each resultset on
> the connection should use the version that was associated with the
> connection when the resultset was opened.

All this has already been solved, since WITH HOLD is supported for
cursors. (I think the actual implementation there copies out to
temporary storage, so perhaps the MVCC approach you suggest is not so
straightforward). Anyway, the missing part is a similar sort of
support for portals at the protocol level - I suggest you aim your
efforts at getting that supported on the server side, since the driver
can't do anything until that is supported.

>> Well every database I know of has it's idiosyncrasies, an as I said
>> the JDBC spec makes no guarantees of what setFetchSize should do if
>> anything.
>>
> The JDBC spec also makes no guarantees that the database shouldn't crash.
> The purpose of a spec isn't to limit what is provided to users, rather it is
> to provide the minimum functionality that users can assume across
> implementations.

I think Dave's point here is that the docs for setFetchSize()
explicitly says that it's a hint to the driver and the driver is free
to ignore it, so a portable application shouldn't be relying on
particular behavior.

Oliver

In response to

pgsql-jdbc by date

Next:From: Tom LaneDate: 2011-10-26 23:18:20
Subject: Re: setFetchSize
Previous:From: John R PierceDate: 2011-10-26 22:37:46
Subject: Re: setFetchSize

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group