Re: ResultSet storing all rows with defaulftFetchSize to 5000

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Brad DeJong <bpd0018(at)gmail(dot)com>
Cc: Jaime Soler <jaime(dot)soler(at)gmail(dot)com>, List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: ResultSet storing all rows with defaulftFetchSize to 5000
Date: 2018-02-09 22:09:47
Message-ID: CADK3HH+X48GfCM=Qo7a1XSuCyGradAXou6+t+x6qtKCXbf9WqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Jaime,

9.4.1208 is considerably out of date. You may want to upgrade.

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

On 8 February 2018 at 19:13, Brad DeJong <bpd0018(at)gmail(dot)com> wrote:

>
>
> On Wed, Feb 7, 2018 at 1:00 PM, Jaime Soler <jaime(dot)soler(at)gmail(dot)com> wrote:
>
>> ... ResultSet holdability is HOLD_CURSOR_OVER_COMMIT. ...
>> And the postgresql comunity jdbc driver 9.4 documentation said:
>> "... There are a number of restrictions which will make the driver
>> silently fall back to fetch the whole ResultSet ..."
>>
>>
> And the statement must be created with a ResultSet holdability of
> CLOSE_CURSORS_AT_COMMIT - which is not documented.
> https://github.com/pgjdbc/pgjdbc/pull/1105 submitted to fix that.
>
> The relevant code fragment from org.postgresql.jdbc.PgStatement.java is
> ...
>
> // Enable cursor-based resultset if possible.
> if (fetchSize > 0 && !wantsScrollableResultSet() &&
> !connection.getAutoCommit()
> && !wantsHoldableResultSet()) {
> flags |= QueryExecutor.QUERY_FORWARD_CURSOR;
> }
>
> And the fragment from org.postgresql.v3.QueryExecutorImpl.java ...
>
> boolean usePortal = (flags & QueryExecutor.QUERY_FORWARD_CURSOR) != 0
> && !noResults && !noMeta
> && fetchSize > 0 && !describeOnly;
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jaime Soler 2018-02-12 15:11:07 Re: ResultSet storing all rows with defaulftFetchSize to 5000
Previous Message Vladimir Sitnikov 2018-02-09 19:58:50 Re: setFetchSize() and preferQueryMode incompatible?