Re: BUG #2658: Query not using index - Mailing list pgsql-performance

From Chris Browne
Subject Re: BUG #2658: Query not using index
Date
Msg-id 60d599gqcz.fsf@dba2.int.libertyrms.com
Whole thread Raw
In response to Re: BUG #2658: Query not using index  (Graham Davis <gdavis@refractions.net>)
Responses Re: BUG #2658: Query not using index  (Graham Davis <gdavis@refractions.net>)
List pgsql-performance
gdavis@refractions.net (Graham Davis) writes:
> 40 seconds is much too slow for this query to run and I'm assuming
> that the use of an index will make it much faster (as seen when I
> removed the GROUP BY clause).  Any tips?

Assumptions are dangerous things.

An aggregate like this has *got to* scan the entire table, and given
that that is the case, an index scan is NOT optimal; a seq scan is.

An index scan is just going to be slower.
--
let name="cbbrowne" and tld="linuxdatabases.info" in String.concat "@" [name;tld];;
http://cbbrowne.com/info/linux.html
"The computer is the ultimate polluter: its feces are
indistinguishable from the food it produces." -- Alan J. Perlis

pgsql-performance by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: Performance Optimization for Dummies 2 - the SQL
Next
From: Graham Davis
Date:
Subject: Re: BUG #2658: Query not using index