Re: Fix gin index cost estimation
Alexander Korotkov <aekorotkov@gmail.com>
From: Alexander Korotkov <aekorotkov@gmail.com>
To: Ronan Dunklau <ronan.dunklau@aiven.io>
Cc: Michael Paquier <michael@paquier.xyz>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@lists.postgresql.org
Date: 2022-10-25T14:08:58Z
Lists: pgsql-hackers
Hi, Ronan! On Wed, Oct 12, 2022 at 10:15 AM Ronan Dunklau <ronan.dunklau@aiven.io> wrote: > > > You're right, I was too eager to try to raise the CPU cost proportionnally > to > > > the number of array scans (scalararrayop). I'd really like to understand > where > > > this equation comes from though... > > > > So, what's the latest update here? > > Thanks Michael for reviving this thread. > > Before proceeding any further with this, I'd like to understand where we > stand. Tom argued my way of charging cost per entry pages visited boils down > to charging per tuple, which I expressed disagreement with. > > If we can come to a consensus whether that's a bogus way of thinking about it > I'll proceed with what we agree on. I briefly read the thread. I think this line is copy-paste from other index access methods and trying to estimate the whole index scan CPU cost by bypassing all the details. *indexTotalCost += (numTuples * *indexSelectivity) * (cpu_index_tuple_cost + qual_op_cost); 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. ------ Regards, Alexander Korotkov
Commits
-
Improve GIN cost estimation
- cd9479af2af2 16.0 landed