Re: Index not used in query. Why?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Index not used in query. Why?
Дата
Msg-id 16865.1098204769@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Index not used in query. Why?  ("Andrei Bintintan" <klodoma@ar-sd.net>)
Список pgsql-performance
"Andrei Bintintan" <klodoma@ar-sd.net> writes:
> Hi to all! I have the following query. The execution time is very big, it
> doesn't use the indexes and I don't understand why...

Indexes are not necessarily the best way to do a large join.

> If I use the following query the indexes are used:

The key reason this wins seems to be that the id_status = 4 condition
is far more selective than id_status > 3 (the estimates are 52 and 36967
rows respectively ... is that accurate?) which means that the second
query is inherently about 1/700th as much work.  This, and not the use
of indexes, is the fundamental reason why it's faster.

            regards, tom lane

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

Предыдущее
От: "Andrei Bintintan"
Дата:
Сообщение: Index not used in query. Why?
Следующее
От: Max Baker
Дата:
Сообщение: Re: Vacuum takes a really long time, vacuum full required