setFetchSize() and preferQueryMode incompatible?

From: Alan Stange <stange(at)rentec(dot)com>
To: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: setFetchSize() and preferQueryMode incompatible?
Date: 2018-02-09 18:51:45
Message-ID: d58c5730-f16c-9109-ac9a-0f6ed2ff7097@rentec.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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);
        }
    }
}

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vladimir Sitnikov 2018-02-09 19:58:50 Re: setFetchSize() and preferQueryMode incompatible?
Previous Message Brad DeJong 2018-02-09 00:13:17 Re: ResultSet storing all rows with defaulftFetchSize to 5000