Re: Startup cost of sequential scan - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Startup cost of sequential scan
Date
Msg-id 9842.1535643199@sss.pgh.pa.us
Whole thread Raw
In response to Re: Startup cost of sequential scan  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> The model (assuming I understand it rightly) is that what we're actually
> tracking is a startup cost and a per-output-row cost, but for comparison
> purposes we actually store the rows and the computed total, rather than
> just the per-row cost:

> rows
> startup_cost
> total_cost = startup_cost + (rows * per_row_cost)

Right.  I tend to think of it differently: the cost to retrieve the
first K rows out of a total of N is
    startup_cost + (total_cost - startup_cost) * K/N
but that comes out to the same thing as what Andrew said.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: Startup cost of sequential scan
Next
From: Alexander Korotkov
Date:
Subject: Re: Startup cost of sequential scan