Re: not fetching all query results

Поиск
Список
Период
Сортировка
От Radim Kolar
Тема Re: not fetching all query results
Дата
Msg-id 5005C1AC.1030106@filez.com
обсуждение исходный текст
Ответ на Re: not fetching all query results  (Dave Cramer <pg@fastcrypt.com>)
Ответы Re: not fetching all query results  (Dave Cramer <pg@fastcrypt.com>)
Список pgsql-jdbc
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()



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: not fetching all query results
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: not fetching all query results