From: Oliver Jowett <oliver@opencloud.com>
To: Maik Wiege <mswiege@gmx.de>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: get row count from a "cursor resultset"
Date: Thu, 07 Jul 2005 10:50:50 +1200
Message-ID: <42CC604A.9050604@opencloud.com> (raw)
In-Reply-To: <42CC5C41.90306@opencloud.com>
References: <42CC2EB6.8020505@gmx.de>
<42CC5ACE.5070200@opencloud.com>
<42CC5C41.90306@opencloud.com>
Oliver Jowett wrote:
> Oliver Jowett wrote:
>
>>Maik Wiege wrote:
>>
>>
>>>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.
>>
>>
>>I'd point out that this does not require knowing exactly how many rows
>>there are -- only that there are more than 100. You can do the
>>equivalent in JDBC easily by setting fetchsize to 100 or so and calling
>>next() 100 times.. if you haven't hit the end of the resultset by that
>>point, it has more than 100 rows.
>
>
> Oh, sorry, my mistake -- I misread your description. Perhaps they are
> using either COUNT(*) in the same query or MOVE to get the number of rows.
Ok, some digging in pgAdmin's svn web interface seems to indicate that
pgadmin is not actually doing anything special here -- it does the full
query via libpq's PQexec(), retrieving all the tuples (and hence can
count them) but only does the work to construct a user interface
displaying them all after that "lots of rows, retrieve anyway?" dialog
has been answered.
You could check this by looking at pgadmin's memory footprint while
retrieving a big resultset.
-O
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: oliver@opencloud.com, mswiege@gmx.de
Subject: Re: get row count from a "cursor resultset"
In-Reply-To: <42CC604A.9050604@opencloud.com>
References: <42CC2EB6.8020505@gmx.de> <42CC5ACE.5070200@opencloud.com> <42CC5C41.90306@opencloud.com> <42CC604A.9050604@opencloud.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