Re: Fix gin index cost estimation - Mailing list pgsql-hackers

From Ronan Dunklau
Subject Re: Fix gin index cost estimation
Date
Msg-id 13151261.uLZWGnKmhe@aivenlaptop
Whole thread Raw
In response to Re: Fix gin index cost estimation  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Fix gin index cost estimation
List pgsql-hackers
Le mardi 25 octobre 2022, 16:18:57 CET Tom Lane a écrit :
> Alexander Korotkov <aekorotkov@gmail.com> writes:
> > I think Tom's point was that it's wrong to add a separate entry-tree CPU
> > cost estimation to another estimation, which tries (very inadequately) to
> > estimate the whole scan cost. Instead, I propose writing better
> > estimations
> > for both entry-tree CPU cost and data-trees CPU cost and replacing
> > existing
> > CPU estimation altogether.
>
> Great idea, if someone is willing to do it ...
>
>             regards, tom lane

Hello,

Sorry for the delay, but here is an updated patch which changes the costing in
the following way:

- add a descent cost similar to the btree one is charged for the initial
entry-tree
- additionally, a charge is applied per page in both the entry tree and
posting trees / lists
- instead of charging the quals to each tuple, charge them per entry only. We
still charge cpu_index_tuple_cost per tuple though.

With those changes, no need to tweak the magic number formula estimating the
number of pages. Maybe we can come up with something better for estimating
those later on ?

Best regards,

--
Ronan Dunklau

Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: ExecRTCheckPerms() and many prunable partitions
Next
From: Amit Langote
Date:
Subject: Re: generic plans and "initial" pruning