Index usage vs large repetitions of key

Поиск
Список
Период
Сортировка
От Francisco Reyes
Тема Index usage vs large repetitions of key
Дата
Msg-id 20020504160120.B66845-100000@zoraida.natserv.net
обсуждение исходный текст
Ответы Re: Index usage vs large repetitions of key  (Neil Conway <nconway@klamath.dyndns.org>)
Список pgsql-general
I have a table with a "year" column.
A count grouped by year is as follows:
=> select year, count(*) from ystats group by year;
 year | count
------+--------
 1992 | 367191
 1993 | 341324
 1994 | 324867
 1995 | 314674
 1996 | 307149
 1997 | 303540
 1998 | 298040
 1999 | 300269
 2000 | 302648
 2001 | 305797
 2002 | 127445
(11 rows)

I created an index by year, but it never seems to get used, not even with
"set enable_seqscan to off;"

I have numerous queries I do against this table that only need to acces
one or two years.

I am making the wrong assumption here that doing an index scan would be
significantly more efficient? If so how do I help the optimizer see this?


В списке pgsql-general по дате отправления:

Предыдущее
От: Jeffrey Baker
Дата:
Сообщение: Re: Subject: bool / vacuum full bug followup part 2
Следующее
От: Neil Conway
Дата:
Сообщение: Re: Index usage vs large repetitions of key