Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Help with unpredictable use of indexes on large tables...



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




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group