Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 12CDB9F9D1D for ; Wed, 19 Sep 2007 09:12:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 70842-06 for ; Wed, 19 Sep 2007 09:12:14 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail.ionicsoft.com (mail.ionicsoft.com [81.188.4.2]) by postgresql.org (Postfix) with ESMTP id 6F3D89F9C77 for ; Wed, 19 Sep 2007 09:12:14 -0300 (ADT) Content-class: urn:content-classes:message Subject: Re: Postgres 8.2 and setFetchSize MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Wed, 19 Sep 2007 14:12:13 +0200 Message-ID: <95484F7A889A61469885286054F675DD51252A@altarf.ionicsoft.com> X-MimeOLE: Produced By Microsoft Exchange V6.5 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [JDBC] Postgres 8.2 and setFetchSize Thread-Index: Acf6s7Kpe8qKqwUsRcaRZT/6FA9m/wAAgWEw References: <95484F7A889A61469885286054F675DD512526@altarf.ionicsoft.com> From: =?iso-8859-1?Q?Fr=E9d=E9ric_Houbie?= To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/96 X-Sequence-Number: 17518 I have one more information, I tried the same code using my local = Postgres database (on my XP, 8.2.4), it is working. What can I check on = the server to see what's wrong ? In my log, I can see it is using a cursor 2007-09-19 14:10:51.993 LOG: duration: 0.000 ms parse S_1: BEGIN 2007-09-19 14:10:51.993 LOG: duration: 0.000 ms bind S_1: BEGIN 2007-09-19 14:10:51.993 LOG: duration: 0.000 ms execute S_1: BEGIN 2007-09-19 14:10:51.993 LOG: duration: 0.000 ms parse S_2: SELECT * = FROM SValues 2007-09-19 14:10:51.993 LOG: duration: 0.000 ms bind S_2/C_3: SELECT = * FROM SValues 2007-09-19 14:10:51.993 LOG: duration: 0.000 ms execute S_2/C_3: = SELECT * FROM SValues 20 Thanks Fr=E9d=E9ric -----Message d'origine----- De=A0: pgsql-jdbc-owner@postgresql.org = [mailto:pgsql-jdbc-owner@postgresql.org] De la part de Fr=E9d=E9ric = Houbie Envoy=E9=A0: mercredi 19 septembre 2007 13:54 =C0=A0: pgsql-jdbc@postgresql.org Objet=A0: [JDBC] Postgres 8.2 and setFetchSize Hi,=20 I'm trying to use the setFetchSize method to get back results faster. = I'm using PostgreSQL 8.2 under XP. I'm using = postgresql-8.2-505.jdbc3.jar driver. I'm connecting to a Postgres on = Linux (PostgreSQL 8.2.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) = 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)). I think that the = setFetchSize do not work. I've read a lot about the conditions for that = to work (autocommit false) but it's not working. Here is my sample code: public static void main(String[] args) throws Exception{ Connection con=3Dnull; try { Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } String s_server =3D = "jdbc:postgresql://regulus:5432/ignimport" ; try { con =3D DriverManager.getConnection(s_server, "bs", = ""); } catch(Exception e) { e.printStackTrace(); } Statement st =3D con.createStatement(); con.setAutoCommit(false); st.setFetchSize(Integer.parseInt(args[0])); System.out.println("FetchSize : " + st.getFetchSize()); String q=3D"SELECT a FROM SValues WHERE Name =3D 'title'"; long t1 =3D System.currentTimeMillis(); ResultSet resultSet =3D st.executeQuery(q); if (resultSet.next()) { String s =3D resultSet.getString(1); } long t2 =3D System.currentTimeMillis(); System.out.println("exec time : " + (t2 - t1)); } It always take the same time (long time) whatever value I pass to this = code for the FetchSize. It is really a problem because I can't use the = LIMIT keywords as I don't know the exact number of records I need. Any advice ?=20 Thanks =20 =20 Fr=E9d=E9ric Houbie =20 ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings