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

LIMIT question

From: "EXT-Rothermel, Peter M" <Peter(dot)M(dot)Rothermel(at)boeing(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: LIMIT question
Date: 2008-08-19 20:58:47
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
I need to use a LIMIT count in a query but I also need to know how many
rows the query itself would yield without the limit.
I can do this inside a transaction like this

SELECT COUNT(*) from table1 where blah;
select * from table1 where blah LIMIT 1000;

Now I can give some feedback like your search matches 200,000 but was
limited to 1000 items.
Is there a better way to accomplish this goal?


pgsql-sql by date

Next:From: Richard BroersmaDate: 2008-08-19 21:08:06
Subject: Re: LIMIT question
Previous:From: Fernando HeviaDate: 2008-08-19 18:38:00
Subject: Re: Cursor

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