Re: Can this be indexed? - Mailing list pgsql-general

From Brent Wood
Subject Re: Can this be indexed?
Date
Msg-id 20041108092555.M64803@storm-user.niwa.co.nz
Whole thread Raw
In response to Re: Can this be indexed?  ("Net Virtual Mailing Lists" <mailinglists@net-virtual.com>)
List pgsql-general

>
> >Net Virtual Mailing Lists wrote:
> >> Is there a way to create an index that would make this query be efficient
> >> and not perform a sequential scan?
> >>
> >> SELECT count(*) AS count,id FROM sometable GROUP BY id;
> >
> >Indexes cannot be used for retrieving results...

I'm not sure if it would improve performance at all, given the entire
table needs to be scanned anyway, but add a where clause "where id > 0"
should allow an index on id to be used.

Possibly a bit like speeding up "select max(id) from ..."

Someone who knows more about the internals of Postgis can prob comment on
the validity/idiocy of this suggestion :-)

Brent Wood

pgsql-general by date:

Previous
From: "Devin L. Ganger"
Date:
Subject: Re: Postresql RFD version 2.0 Help Wanted.
Next
From: Brent Wood
Date:
Subject: Re: Can this be indexed?