setFetchSize() and preferQueryMode incompatible?
От | Alan Stange |
---|---|
Тема | setFetchSize() and preferQueryMode incompatible? |
Дата | |
Msg-id | d58c5730-f16c-9109-ac9a-0f6ed2ff7097@rentec.com обсуждение исходный текст |
Ответы |
Re: setFetchSize() and preferQueryMode incompatible?
|
Список | 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 по дате отправления: