Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 549871297416 for ; Tue, 17 Jul 2012 16:49:38 -0300 (ADT) Received: from ponto.amerinoc.com ([64.6.108.239]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SrDm4-00050Z-VB for pgsql-jdbc@postgresql.org; Tue, 17 Jul 2012 19:49:37 +0000 Received: from fbsd8.localdomain (205.83.broadband7.iol.cz [88.102.83.205]) (authenticated bits=128) by ponto.amerinoc.com (8.14.5/8.14.5) with ESMTP id q6HJnB8G036238 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 Jul 2012 21:49:15 +0200 (CEST) (envelope-from hsn@filez.com) Received: from [127.0.0.1] ([10.0.0.1]) by fbsd8.localdomain (8.14.5/8.14.4) with ESMTP id q6HJn5eM011569; Tue, 17 Jul 2012 21:49:06 +0200 (CEST) (envelope-from hsn@filez.com) Message-ID: <5005C1AC.1030106@filez.com> Date: Tue, 17 Jul 2012 21:49:00 +0200 From: Radim Kolar User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Dave Cramer CC: PostgreSQL JDBC Subject: Re: not fetching all query results References: <50044D96.3050902@filez.com> <5004D8F2.509@ringerc.id.au> <50055065.6080308@filez.com> <500585D1.1000801@filez.com> <5005AB7C.5010508@filez.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 120717-0, 17.07.2012), Outbound message X-Antivirus-Status: Clean X-Pg-Spam-Score: -0.0 (/) X-Archive-Number: 201207/31 X-Sequence-Number: 23129 with 5m result set you can set fetchsize to any value it has no effect @GrabConfig(systemClassLoader = true) @Grab(group='postgresql', module='postgresql', version='8.3-603.jdbc4') @Grab(group='commons-lang', module='commons-lang', version='2.6') import groovy.sql.Sql import org.apache.commons.lang.math.RandomUtils def sql=Sql.newInstance("jdbc:postgresql://localhost/grails", "postgres", "postgres") sql.setCacheStatements(true) /* sql.withTransaction { for (i in 1..5000000 ) { sql.executeUpdate("insert into public.test (a) values (?)", [RandomUtils.nextLong()]) } } */ def c = sql.getConnection() def s = c.createStatement() s.setFetchSize(100000) def r = s.executeQuery("select * from public.test") def cnt = 0 while (r.next()) { cnt++ } println "${cnt} rows." sql.close()