Re: index vs seqscan question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: index vs seqscan question
Дата
Msg-id 28753.1038004241@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: index vs seqscan question  (Frank Bax <fbax@sympatico.ca>)
Ответы Re: index vs seqscan question  (Frank Bax <fbax@sympatico.ca>)
Список pgsql-general
Frank Bax <fbax@sympatico.ca> writes:
> OK, I should have finished testing my changes before posting - the
> new/faster query should have brackets around (typ=' ' OR typ='A'), but its
> still fast as lightning!  I don't think it made a big difference to explain
> results, but it appears seqscan is cheaper than it was before?

The version with the typo couldn't use an indexscan, I think (planner's
not real smart about asymmetrical AND/OR structures).  The fixed
version is probably going for seqscan because with the additional AND
condition, it's estimating fewer rows need to be sorted.  The seqscan
isn't getting cheaper, but the sort is.

Looking only at the planner's estimates is not very reliable though.
What does EXPLAIN ANALYZE have to say?

            regards, tom lane

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

Предыдущее
От: Frank Bax
Дата:
Сообщение: Re: index vs seqscan question
Следующее
От: Eric B.Ridge
Дата:
Сообщение: Re: UNION and array types