Secondary indexes

Поиск
Список
Период
Сортировка
От Leandro Fanzone
Тема Secondary indexes
Дата
Msg-id 3A82EADD.82277F2A@hasar.com
обсуждение исходный текст
Ответ на Recasting data type  (Conrad Schuler <conrad.schuler@masks.org>)
Ответы Re: Secondary indexes
Список pgsql-novice
Hello. I have a table with, say, three fields. The first is the ID (integer,
unique, primary index). The second is an optional index that sometimes can be
blank, or even duplicated, a varchar(13). The third one is the data I want to
retrieve, it has no importance in this problem. I need to access sometimes by the
ID and sometimes by the secondary key, so I made an index using

CREATE INDEX my_index_name ON MY_TABLE(my_secondary_id);

When I select using the primary key, obviously uses the index created by default.
When I select using the secondary key, it EXPLAINs me that it would use sequencial
scan instead of the index I created, thus this search becomes extremely slow. Why
the engine would ignore the index? Do I have to make it "available" in some way I
am not aware of? I VACUUM ANALYZEd already, and nothing changed.
I thank you in advance any help.

Leandro.






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

Предыдущее
От: David Merrill
Дата:
Сообщение: Re: Recasting data type
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Secondary indexes