Re: BUG #2658: Query not using index

From: Chris Browne <cbbrowne(at)acm(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: BUG #2658: Query not using index
Date: 2006-10-03 19:18:36
Message-ID: 60d599gqcz.fsf@dba2.int.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-performance

gdavis(at)refractions(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Graham Davis 2006-10-03 20:32:24 Re: BUG #2658: Query not using index
Previous Message Tom Lane 2006-10-03 19:17:12 Re: drop view stalled during pg_dump

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2006-10-03 19:21:06 Re: Performance Optimization for Dummies 2 - the SQL
Previous Message Graham Davis 2006-10-03 19:13:43 Re: BUG #2658: Query not using index