Re: How to get total number of rows when using LIMIT/OFFSET?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Dirk Lutzebaeck <lutzeb(at)aeccom(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to get total number of rows when using LIMIT/OFFSET?
Date: 2002-07-11 01:50:45
Message-ID: 200207110150.g6B1ojh18807@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dirk Lutzebaeck wrote:
>
> Hello,
>
> when using LIMIT/OFFSET is it possible to get also the total number of rows
> besides the actual number of rows of the select? It should be there
> because the whole list is ordered anyhow. I'm using 7.2.1.

No way to do that. Perhaps a CURSOR and look at the total count. Not
sure if that works but I think it should.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2002-07-11 02:05:54 Re: pg_restore cannot restore index
Previous Message David Durst 2002-07-11 00:37:41 Returning rows from functions