Re: disabling seqscan not using primary key index?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: disabling seqscan not using primary key index?
Дата
Msg-id 2312912.1621099035@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: disabling seqscan not using primary key index?  (Luca Ferrari <fluca1978@gmail.com>)
Список pgsql-general
Luca Ferrari <fluca1978@gmail.com> writes:
> On Sat, May 15, 2021 at 4:40 PM David Rowley <dgrowleyml@gmail.com> wrote:
>> The answer is fairly simple, the planner just never considers using
>> the primary key index as there are no possible cases where it would be
>> useful.

> Does this mean that any UNIQUE constraint on the table is subject to
> the same consideration?

David's statement applies to any index.  Per the code in indxpath.c:

     * 4. Generate an indexscan path if there are relevant restriction clauses
     * in the current clauses, OR the index ordering is potentially useful for
     * later merging or final output ordering, OR the index has a useful
     * predicate, OR an index-only scan is possible.

If none of those cases apply, an indexscan is guaranteed to be worse
than a seqscan, so we don't consider it.

            regards, tom lane



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

Предыдущее
От: Luca Ferrari
Дата:
Сообщение: Re: disabling seqscan not using primary key index?
Следующее
От: Venkata B Nagothi
Дата:
Сообщение: Re: Postgres upgrade 12 - issues with OIDs