Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] JDBC line count in query result

From: Peter T Mount <peter(at)retep(dot)org(dot)uk>
To: ertl(at)bigfoot(dot)com
Cc: "pgsql-sql(at)postgreSQL(dot)org" <pgsql-sql(at)postgresql(dot)org>, "pgsql-interfaces(at)postgreSQL(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: [INTERFACES] JDBC line count in query result
Date: 1998-08-04 17:48:48
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfacespgsql-sql
On Tue, 4 Aug 1998, Bernhard Ertl wrote:

> If I do a query with psql there is the number of returned lines at the
> end.
> Is this also, if I do a query via jdbc and can I access this number
> before I process the results??

Not before you process the results.

This is an age old question with JDBC (includes why there isn't a standard
way of going backwards in a ResultSet - I haven't looked at the JDBC 2
spec but it may be in there...).

The problem is that most databases don't know how many rows are to be
returned to the client, until they have finished sending it.

It's basically a performance thing.

The only way to know how many are returned is to count the results your
self while reading the ResultSet.

Peter T Mount peter(at)retep(dot)org(dot)uk or petermount(at)earthling(dot)net
Main Homepage:
PostgreSQL JDBC Faq:

In response to

pgsql-interfaces by date

Next:From: Þórður ÍvarssonDate: 1998-08-04 19:36:13
Subject: How to get correct alphabetical order
Previous:From: Oleg BartunovDate: 1998-08-04 17:42:44
Subject: Re: [INTERFACES] How translate KOI-8 to Win1251 whith PsqlODBC

pgsql-sql by date

Next:From: Thomas GoodDate: 1998-08-04 19:15:19
Subject: Re: [SQL] locked my keys in the car
Previous:From: chris yamboDate: 1998-08-04 16:07:46
Subject: subscribe pgsql-sql

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group