Re: Help with unpredictable use of indexes on large tables... - Mailing list pgsql-general

From John D. Burger
Subject Re: Help with unpredictable use of indexes on large tables...
Date
Msg-id 03e9355ec9b2b3208aa3a79384498a45@mitre.org
Whole thread Raw
In response to Re: Help with unpredictable use of indexes on large tables...  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Help with unpredictable use of indexes on large tables...
List pgsql-general
Tom Lane wrote:

> Also I'd suggest trying
>
>     select year from [table] group by year
>
> which is capable of using a hash aggregation approach; that will likely
> beat either of these plans.

Just out of curiosity, why doesn't the planner consider the same plan
for the OP's original query:

   select distinct year from [table]

Aren't these equivalent (except for the order)?

Thanks.

- John Burger


pgsql-general by date:

Previous
From: Jessica M Salmon
Date:
Subject: file I/O in plpgsql
Next
From: "Florian G. Pflug"
Date:
Subject: Re: configure: error