Re: setFetchSize() and preferQueryMode incompatible? - Mailing list pgsql-jdbc

From Vladimir Sitnikov
Subject Re: setFetchSize() and preferQueryMode incompatible?
Date
Msg-id CAB=Je-EvOXHcoQcH=xxXQdru_cLbr23Ad3_1qSSWatmpvAYEsQ@mail.gmail.com
Whole thread Raw
In response to setFetchSize() and preferQueryMode incompatible?  (Alan Stange <stange@rentec.com>)
List 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

pgsql-jdbc by date:

Previous
From: Alan Stange
Date:
Subject: setFetchSize() and preferQueryMode incompatible?
Next
From: Dave Cramer
Date:
Subject: Re: ResultSet storing all rows with defaulftFetchSize to 5000