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

From Alan Stange
Subject setFetchSize() and preferQueryMode incompatible?
Date
Msg-id d58c5730-f16c-9109-ac9a-0f6ed2ff7097@rentec.com
Whole thread Raw
Responses Re: setFetchSize() and preferQueryMode incompatible?  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
List pgsql-jdbc
Hello all,

I've been playing around a little with using preferQueryMode set to 
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.     We were also attempting to setFetchSize 
and found these two settings will not work together in any of the 
42.2.1, 42.1.4 or 9.4.1202 jdbc client builds running against a 9.6.x 
version server.

Is this a bug or a "feature"?

Below is the sample code.  The fetch size will not be respected with the 
preferQueryMode property present.

Thank you for having a look.

-- Alan



public class Work {

     public static void main(String ... args) throws SQLException {

         // make obvious changes here....
         String url = "jdbc:postgresql://host:5432/db";
         String user = "user";
         String passwd = "pass";

         Properties props = new Properties();
         props.put("user", user);
         props.put("password", passwd);
         props.put("preferQueryMode", "extendedForPrepared");

         Connection conn = DriverManager.getConnection(url, props);
         conn.setAutoCommit(false);
         Statement st = conn.createStatement();
         st.setFetchSize(1024);
         ResultSet rs = st.executeQuery("select * from reallyBigTable");
         while (rs.next()) {
             rs.getObject(1);
         }
     }
}


pgsql-jdbc by date:

Previous
From: Brad DeJong
Date:
Subject: Re: ResultSet storing all rows with defaulftFetchSize to 5000
Next
From: Vladimir Sitnikov
Date:
Subject: Re: setFetchSize() and preferQueryMode incompatible?