Re: index paths and enable_indexscan

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: index paths and enable_indexscan
Date: 2020-04-14 08:58:36
Message-ID: CA+HiwqE4pMu3uru7UPc7-r3-QMYr77p4ChcW+j3LzRG9ZRphAQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 14, 2020 at 5:29 PM Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> wrote:
> On Tue, Apr 14, 2020 at 3:40 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
>> On Tue, Apr 14, 2020 at 4:13 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>> > On Tue, Apr 14, 2020 at 2:44 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
>> >> Maybe I am missing something obvious, but is it intentional that
>> >> enable_indexscan is checked by cost_index(), that is, *after* creating
>> >> an index path? I was expecting that if enable_indexscan is off, then
>> >> no index paths would be generated to begin with, because I thought
>> >> they are optional.
>> >
>> > I think the cost estimate of index paths is the same as other paths on
>> > that setting enable_xxx to off only adds a penalty factor (disable_cost)
>> > to the path's cost. The path would be still generated and compete with
>> > other paths in add_path().
>>
>> Yeah, but I am asking why build the path to begin with, as there will
>> always be seq scan path for base rels.
>
> I guess that is because user may disable seqscan as well. If so, we
> still need formula to decide with one to use, which requires index path
> has to be calculated. but since disabling the two at the same time is rare,
> we can ignore the index path build if user allow seqscan

I am saying that instead of building index path with disabled cost,
just don't build it at all. A base rel will always have a sequetial
path, even though with disabled cost if enable_seqscan = off.

--

Amit Langote
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2020-04-14 09:00:21 Re: Lexer issues
Previous Message Julien Rouhaud 2020-04-14 08:54:54 Re: Display of buffers for planning time show nothing for second run