pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Radim Kolar <hsn@filez.com>
To: Dave Cramer <pg@fastcrypt.com>
Cc: PostgreSQL JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: not fetching all query results
Date: Tue, 17 Jul 2012 21:49:00 +0200
Message-ID: <5005C1AC.1030106@filez.com> (raw)
In-Reply-To: <CADK3HH+HEot-uX0Vd23dN0nQW8Nrp2+E6gTFVN9TvLWHW7-cLw@mail.gmail.com>
References: <50044D96.3050902@filez.com>
	<5004D8F2.509@ringerc.id.au>
	<50055065.6080308@filez.com>
	<CADK3HH+UboShbu12+V3N21wtXoEW4vYPHydWVcn47n01i2jjug@mail.gmail.com>
	<500585D1.1000801@filez.com>
	<CADK3HHLx74z3c=YNvRYBsxErfVyifchzEcuwXgpgN4C_YAhtQQ@mail.gmail.com>
	<5005AB7C.5010508@filez.com>
	<CADK3HH+03Z3jik+G5XTpT9C0H3JzOgomYHL1fTNVi-ZJFdtRwQ@mail.gmail.com>
	<CADK3HH+HEot-uX0Vd23dN0nQW8Nrp2+E6gTFVN9TvLWHW7-cLw@mail.gmail.com>

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()





view thread (27+ messages)  latest in thread

Message-ID: <5005C1AC.1030106@filez.com>
Permalink:  ../5005C1AC.1030106@filez.com/
Also on:    postgresql.org/message-id/5005C1AC.1030106@filez.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: hsn@filez.com, pg@fastcrypt.com
  Subject: Re: not fetching all query results
  In-Reply-To: <5005C1AC.1030106@filez.com>
  References: <50044D96.3050902@filez.com> <5004D8F2.509@ringerc.id.au> <50055065.6080308@filez.com> <CADK3HH+UboShbu12+V3N21wtXoEW4vYPHydWVcn47n01i2jjug@mail.gmail.com> <500585D1.1000801@filez.com> <CADK3HHLx74z3c=YNvRYBsxErfVyifchzEcuwXgpgN4C_YAhtQQ@mail.gmail.com> <5005AB7C.5010508@filez.com> <CADK3HH+03Z3jik+G5XTpT9C0H3JzOgomYHL1fTNVi-ZJFdtRwQ@mail.gmail.com> <CADK3HH+HEot-uX0Vd23dN0nQW8Nrp2+E6gTFVN9TvLWHW7-cLw@mail.gmail.com> <5005C1AC.1030106@filez.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox