Basic cost computation
The job of the query optimizer is to generate many possible plans that could be used to execute a query, then pick the one with the lowest cost to actually execute. The cost computations are done using arbitrary units only loosely associated with real-world execution cost.
seq_page_cost
: How long it takes to read a single database page from disk when the expectation is you'll be reading several that are next to one another, a sequential read of a section of disk. The rest of the cost parameters are essentially relative to this value being the reference cost of 1.0.random_page_cost
: Read cost when the rows involved are expected to be scattered across the disk at random. This defaults to 4.0.cpu_tuple_cost
: How much it costs to process a single row of data. The default is 0.01.cpu_index_tuple_cost
: Cost to process a single index entry during an index scan. The default is 0.005, lower than what it costs to process a row because rows have a lot more header...