Re: Get the number of records of a result set

From: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
To: Eugenio Tacchini <eugenio(dot)tacchini(at)elfo(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Get the number of records of a result set
Date: 2008-01-30 08:35:17
Message-ID: 1201682117.12583.1.camel@neuromancer.home.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Wed, 2008-01-30 at 09:14 +0100, Eugenio Tacchini wrote:
> Hello,
> I'm writing a function in PL/pgSQL and I would like to know if there
> is a method to get the number of records in a result set, after a
> select query, without executing the same query using COUNT(*).

not sure what exactly you mean, but perhaps this could help?

del_stime := timeofday();
execute del_qry;
del_etime := timeofday();

GET DIAGNOSTICS del_rows = ROW_COUNT;

This would get you the # of rows inserted into the destination table
etc.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Håkan Jacobsson 2008-01-30 08:35:21 Re: Getting the count(*) from two tables and two date ranges in same query
Previous Message Pavel Stehule 2008-01-30 08:33:42 Re: Get the number of records of a result set