group by - Mailing list pgsql-general

From Kathy Zhu
Subject group by
Date
Msg-id 200310032230.h93MUHc29961@amon.Central.Sun.COM
Whole thread Raw
Responses Re: group by  (Dennis Gearon <gearond@fireserve.net>)
Re: group by  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
Re: group by  (Kris Jurka <books@ejurka.com>)
List pgsql-general
Hi,

I notices a weird thing here.

version 7.2.1
on Solaris

table "test", has a field "state".
There are 4 "state" values, 1, 2, 3, 4.

select count(*) from test group by state;
took 11500 msec

but

select count(*) from test where state = 1;
select count(*) from test where state = 2;
select count(*) from test where state = 3;
select count(*) from test where state = 4;
total took 626 msec

Why ??

thanks,
kathy



pgsql-general by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: pg_restore takes ages
Next
From: Dennis Gearon
Date:
Subject: Re: group by