| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера