X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A3C255284E for ; Wed, 6 Jul 2005 16:19:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59516-01 for ; Wed, 6 Jul 2005 19:19:22 +0000 (GMT) Received: from mail.gmx.net (pop.gmx.de [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id 5EE3152999 for ; Wed, 6 Jul 2005 16:19:20 -0300 (ADT) Received: (qmail invoked by alias); 06 Jul 2005 19:19:20 -0000 Received: from p83.129.197.248.tisdip.tiscali.de (EHLO [192.168.1.4]) [83.129.197.248] by mail.gmx.net (mp017) with SMTP; 06 Jul 2005 21:19:20 +0200 X-Authenticated: #842999 Message-ID: <42CC2EB6.8020505@gmx.de> Date: Wed, 06 Jul 2005 21:19:18 +0200 From: Maik Wiege Organization: end.net User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: get row count from a "cursor resultset" Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200507/32 X-Sequence-Number: 13180 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