The job of the query optimizer is to generate many possible plans that could be used to execute a query, and 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 the 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: The read cost when the rows involved are expected to be scattered across the disk at random. This defaults to 4.0.
- cpu_tuple_cost ...