Search Postgresql Archives

Re: disabling seqscan not using primary key index?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Luca Ferrari <fluca1978@xxxxxxxxx> writes:
> On Sat, May 15, 2021 at 4:40 PM David Rowley <dgrowleyml@xxxxxxxxx> 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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux