get row count from a "cursor resultset"

Поиск
Список
Период
Сортировка
От Maik Wiege
Тема get row count from a "cursor resultset"
Дата
Msg-id 42CC2EB6.8020505@gmx.de
обсуждение исходный текст
Ответы Re: get row count from a "cursor resultset"  (Oliver Jowett <oliver@opencloud.com>)
Список pgsql-jdbc
Hello!
I'm querying my database and sometimes get a very big resultset back, so
I needed to use a resultset with a cursor to avoid a OutOfMemoryError.

Now, because I have to use a TYPE_FORWARD_ONLY resultset for that, I can
not use the result.last() function anymore to retrieve the amount of
rows the query returns.

The query is a little bit complicated and that for can take some time,
so I don't want to do the "SELECT COUNT(*) FROM (SELECT...)" afterward,
what would result in doing the query twice and there for would double
the time needed.

I didn't find a solution for this, but there must be, because the
pgAdmin III - tool does this. After starting the query in the SQL-Dialog
it asks wether to retrieve just the first 100 results or all results
displaying the corect amount of found rows. Or is this just not possible
with jdbc.

Thanks for any help

   Maik

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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: JDBCCTS issues
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: get row count from a "cursor resultset"