Re: Improved Cost Calculation for IndexOnlyScan

From: Hamid Akhtar <hamid(dot)akhtar(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Improved Cost Calculation for IndexOnlyScan
Date: 2020-10-13 12:56:35
Message-ID: CANugjhuH10PNX3t1X=k9AhApSgGx6Qi8Brpz=cPB9+4-ThbuPg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 12, 2020 at 3:46 PM Hamid Akhtar <hamid(dot)akhtar(at)gmail(dot)com> wrote:

>
>
> On Tue, Sep 29, 2020 at 2:57 PM Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
> wrote:
>
>> On 29/09/2020 11:49, Hamid Akhtar wrote:
>> > So, not actually random replacement here, rather a change with
>> > baserel->allvisfrac taken into consideration (as given below):
>> > ----
>> > index_random_page_cost = Min(spc_seq_page_cost + spc_random_page_cost *
>> > (1.0 - baserel->allvisfrac), spc_random_page_cost);
>> > ----
>> >
>> > Does this make sense?
>>
>> No. genericcostestimate() is only concerned with accesses to the index,
>> not the the heap accesses that are needed with Index Scans. 'allvisfrac'
>> should not affect the number of *index* pages fetched in any way.
>>
>> - Heikki
>>
>
> Currently, the costing for indexonlyscan only differs based on
> 'allvisfrac'. IIUC, the current implementation changes the number of pages
> being fetched based on 'allvisfrac'.
>
> This patch actually makes indexonlyscan specific changes
> to genericcostestimate function. Currently, regardless of the value of
> 'allvisfrac', it is being assumed that the cost of fetching index pages is
> random page cost. That is not aligned with the current cost calculation for
> indexonlyscan. Therefore, I'm suggesting to reduce the random page in a
> similar fashion in case of indexonlyscan.
>
> I'm adding this to the commitfest.
>

Retrospectively looking at the patch, I see your point. Your criticism is
valid. I'll revalidate this issue and rework the patch if necessary.

>
> --
> Highgo Software (Canada/China/Pakistan)
> URL : www.highgo.ca
> ADDR: 10318 WHALLEY BLVD, Surrey, BC
> CELL:+923335449950 EMAIL: mailto:hamid(dot)akhtar(at)highgo(dot)ca
> SKYPE: engineeredvirus
>

--
Highgo Software (Canada/China/Pakistan)
URL : www.highgo.ca
ADDR: 10318 WHALLEY BLVD, Surrey, BC
CELL:+923335449950 EMAIL: mailto:hamid(dot)akhtar(at)highgo(dot)ca
SKYPE: engineeredvirus

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Russell Foster 2020-10-13 13:10:43 [Patch] Using Windows groups for SSPI authentication
Previous Message Rémi Lapeyre 2020-10-13 12:49:07 Re: Add header support to text format and matching feature