Re: [HACKERS] BRIN cost estimate - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] BRIN cost estimate
Date
Msg-id 12378.1491493675@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] BRIN cost estimate  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: [HACKERS] BRIN cost estimate  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Logical Replication and Character encoding
Next
From: Fujii Masao
Date:
Subject: Re: [HACKERS] Remove pg_stat_progress_vacuum from Table 28.2