Re: getting count for a specific querry

Поиск
Список
Период
Сортировка
Искать
От
Ragnar Hafstað
Тема
Re: getting count for a specific querry
Дата
Msg-id
1112977065.7444.30.camel@localhost.localdomain
Ответ на
Список
Дерево обсуждения
getting count for a specific querry "Joel Fradkin" <jfradkin@wazagua.com>
Re: getting count for a specific querry Ragnar Hafstað <gnari@simnet.is>
Re: getting count for a specific querry Tom Lane <tgl@sss.pgh.pa.us>
Re: getting count for a specific querry Rod Taylor <pg@rbt.ca>
Re: getting count for a specific querry Ragnar Hafstað <gnari@simnet.is>
Re: getting count for a specific querry Andrew Sullivan <ajs@crankycanuck.ca>
Re: getting count for a specific querry Ragnar Hafstað <gnari@simnet.is>
Re: getting count for a specific querry Andrew Sullivan <ajs@crankycanuck.ca>
Re: getting count for a specific querry "Joel Fradkin" <jfradkin@wazagua.com>
Re: getting count for a specific querry Scott Marlowe <smarlowe@g2switchworks.com>
Re: getting count for a specific querry "Joel Fradkin" <jfradkin@wazagua.com>
Re: getting count for a specific querry Andrew Sullivan <ajs@crankycanuck.ca>
Re: getting count for a specific querry Bob Henkel <luckyratfoot@gmail.com>
Re: getting count for a specific querry "Joel Fradkin" <jfradkin@wazagua.com>
Re: getting count for a specific querry Vivek Khera <vivek@khera.org>
Re: getting count for a specific querry Scott Marlowe <smarlowe@g2switchworks.com>
Re: getting count for a specific querry Vivek Khera <vivek@khera.org>
Re: getting count for a specific querry Scott Marlowe <smarlowe@g2switchworks.com>
Re: getting count for a specific querry Bob Henkel <luckyratfoot@gmail.com>
Re: getting count for a specific querry Scott Marlowe <smarlowe@g2switchworks.com>
Re: getting count for a specific querry Bob Henkel <luckyratfoot@gmail.com>
Re: getting count for a specific querry Vivek Khera <vivek@khera.org>
Re: getting count for a specific querry Scott Marlowe <smarlowe@g2switchworks.com>
Re: getting count for a specific querry "Joel Fradkin" <jfradkin@wazagua.com>
Re: getting count for a specific querry Vivek Khera <vivek@khera.org>
Re: getting count for a specific querry Scott Marlowe <smarlowe@g2switchworks.com>
Re: getting count for a specific querry Vivek Khera <vivek@khera.org>
Re: getting count for a specific querry Scott Marlowe <smarlowe@g2switchworks.com>
Re: getting count for a specific querry Mischa Sandberg <mischa.sandberg@telus.net>
Re: getting count for a specific querry "Joel Fradkin" <jfradkin@wazagua.com>
Re: getting count for a specific querry PFC <lists@boutiquenumerique.com>
Re: getting count for a specific querry Bob Henkel <luckyratfoot@gmail.com>
Re: getting count for a specific querry Tom Lane <tgl@sss.pgh.pa.us>
Re: getting count for a specific querry "Joel Fradkin" <jfradkin@wazagua.com>
Re: getting count for a specific querry John DeSoi <desoi@pgedit.com>
Re: getting count for a specific querry Bob Henkel <luckyratfoot@gmail.com>
Re: getting count for a specific querry John DeSoi <desoi@pgedit.com>
Re: getting count for a specific querry PFC <lists@boutiquenumerique.com>
On Fri, 2005-04-08 at 11:07 -0400, Andrew Sullivan wrote:
> On Fri, Apr 08, 2005 at 09:29:13AM -0400, Joel Fradkin wrote:
> > 
> > Is there a fast way to get the count? 
> 
> Not really, no.  You have to perform a count() to get it, which is
> possibly expensive.  One way to do it, though, is to do 
> 
> 	SELECT count(*) FROM tablename WHERE condition LIMIT n;
> 
> or something like that.  Assuming the condition is reasonably limited
> (i.e. it's not going to cost you a fortune to run this), you'll get
> the right number back if the number is < n or else you'll get
> n.

come again ?

test=# select count(*) from a;count
-------    3
(1 row)

test=# select count(*) from a limit 2;count
-------    3
(1 row)

the LIMIT clause limits the number of rows returned by the select,
in this case 1 row.

maybe you mean something like:

test=# select count(*) from (select * from a limit 2) as foo;count
-------    2
(1 row)

gnari



В списке pgsql-sql по дате отправления
От: Richard Huxton
Дата:
От: Ragnar Hafstað
Дата:
FAQ