David Rowley <david.rowley@2ndquadrant.com> writes:
> + *indexTotalCost += 0.1 * cpu_operator_cost * estimatedRanges *
> + pagesPerRange;
> This is trying to cost up the following code in bringetbitmap()
> if (addrange)
> {
> BlockNumber pageno;
> for (pageno = heapBlk;
> pageno <= heapBlk + opaque->bo_pagesPerRange - 1;
> pageno++)
> {
> MemoryContextSwitchTo(oldcxt);
> tbm_add_page(tbm, pageno);
> totalpages++;
> MemoryContextSwitchTo(perRangeCxt);
> }
> I'm charging 0.1 * cpu_operator_cost for each loop we expect to
> perform here.
TBH, I think that code is in the noise. It doesn't involve any disk
access, or catalog access, or user-defined function calls. I wouldn't
bother trying to account for it.
What you should be accounting for is the ensuing heap page accesses,
but I assume that's done somewhere else.
regards, tom lane