Obtaining a total number of records in a cursor (Count)

From: Michael Dunn <michael(at)2cactus(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Obtaining a total number of records in a cursor (Count)
Date: 2001-04-04 01:41:04
Message-ID: 3ACA7BB0.7020106@2cactus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am curious to know if there is a command to obtain the number of
records (tuples) in a cursor such as a count(*)? I have an app. using
the libpq API that allows the user to search a database and then stores
those results in a cursor... in turn, the app. allows the user to scroll
through the resutls n at a time. However, I also want to display the
total number of records returned from the search. It seems highly
innefficient to do a SELECT count(*) and then standard SELECT of the
same query... After declaring a cursor and passing resutls into it...
is there a command, temporary table, or session in memory that I can
obtain a total count of records for that cursor?

Regards,
Michael

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-04-04 04:37:44 Re: Obtaining a total number of records in a cursor (Count)
Previous Message rjtalbo 2001-04-04 01:28:10 Caldera eDesktop 2.4 vs eServer 2.3