Re: setFetchSize() and preferQueryMode incompatible?

From: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
To: Alan Stange <stange(at)rentec(dot)com>
Cc: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: Re: setFetchSize() and preferQueryMode incompatible?
Date: 2018-02-09 19:58:50
Message-ID: CAB=Je-EvOXHcoQcH=xxXQdru_cLbr23Ad3_1qSSWatmpvAYEsQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,

TL;DR: it works as expected/designed.

Alan>extendedForPrepared to avoid the multiple round trips to the server.
The default setting is a significant performance impact if there is any
meaningful network latency

Would you please elaborate and/or provide a test case for the "performance
impact"?
Note: you might want to collect some trace logs
(loggerLevel=TRACE&loggerFile=pgjdbc-trace.log) in order to count the
roundtrips.

Alan>The fetch size will not be respected with the
preferQueryMode property present

That setting means pgjdbc would use "Simple Query" to execute
con.createStatement() kind of statements.
"Simple query" does not support portals, and there is no room to specify
"fetch size".
It is just <<'Q' len:Int32 text:string>> message to the server, and it
always replies with full set of rows.

In case you absolutely need to use preferQueryMode=extendedForPrepared, you
can make fetchsize to work by using con.prepareStatement(...)

Vladimir

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2018-02-09 22:09:47 Re: ResultSet storing all rows with defaulftFetchSize to 5000
Previous Message Alan Stange 2018-02-09 18:51:45 setFetchSize() and preferQueryMode incompatible?